How can i get content from xml file in a string format?

  • Thread starter Thread starter stringy
  • Start date Start date
S

stringy

How can i get content from xml file in a string format?

I have an xml file. Within the xml file is html code.
I want to do:

string webpage = !! somehow read xmlfile as a string
Response.Write(webpage);

what do i need in order to do this?

thanks
 
stringy said:
How can i get content from xml file in a string format?

I have an xml file. Within the xml file is html code.
I want to do:

string webpage = !! somehow read xmlfile as a string
Response.Write(webpage);

what do i need in order to do this?

thanks

If you just want to "response.write" the entire file, there is also
Response.WriteFile(filename);


Hans Kesting
 
stringy said:
How can i get content from xml file in a string format?

I have an xml file. Within the xml file is html code.
I want to do:

string webpage = !! somehow read xmlfile as a string
Response.Write(webpage);

protected override void Render(HtmlTextWriter writer)
{
string file = Server.MapPath("file.xml");
using (System.IO.StreamReader sr = new System.IO.StreamReader(file,
System.Text.Encoding.Default,false))
{
writer.Write(sr.ReadToEnd());
}
}
 
Back
Top