Show XML data

  • Thread starter Thread starter Looch
  • Start date Start date
L

Looch

All,

I'm using the following code in a blank page:

public void Page_Load(object sender, EventArgs e)
{
...
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(receipt.getIndividualReceipt(a, b));
}

How can I show the XML data that is in xdoc without saving the file
locally (which I'm not sure is even possible) and opening it?

Thanks in advance.
 
I should probably clarify this a little, I'd like to display the data
in raw form similarly to opening an XML file that doesn't have any
kind of style sheet. Thanks.
 
You can apply an xslt withoug saving the file
Or d you mean woth want to stream it out to the screen
Elaborate more
 
You can apply an xslt withoug saving the file
Or d you mean woth want to stream it out to the screen
Elaborate more
 
Looch said:
I should probably clarify this a little, I'd like to display the data
in raw form similarly to opening an XML file that doesn't have any
kind of style sheet. Thanks.

You could output xdoc.OuterXml.
 
I'd like to stream it out to the screen.

I understand how this would work:

Console.WriteLine(xdoc.OuterXml);

But what should replace the Console.WriteLine if outputting to a blank
page?
 
Ok, so I figured out that I needed Response.Write. Sheesh.

That seems to render the XML string returned from SQL server without
the element tags and all ran together. I loaded an XML doc with the
string (xdoc.Load(SqlResult). Response.Write has a constructor for an
object parameter but I get an error if I use xdoc as the parameter.
I'd like to render xdoc on the screen formatted with the element tags
and indenting. Why wouldn't I be able to use the xdoc object in
Response.Write?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top