S SamIAm Nov 24, 2003 #1 Is there a way to do this without looping through all the nodes using read() I need to return the contents of the reader as a string Thanks S
Is there a way to do this without looping through all the nodes using read() I need to return the contents of the reader as a string Thanks S
G Greg Merideth Nov 24, 2003 #2 You can try something like StreamReader sr = new StreamReader(s); transForm.Load(new XmlTextReader(new StringReader(sr.ReadToEnd()))); Thats just a snippted to load in an .xsl file but you can use the same approach. Use .ReadToEnd() and pass that to your string to hold the data. XmlDocument.Load simply loads in the entire XML file into memory which then you can convert .ToString() as well.
You can try something like StreamReader sr = new StreamReader(s); transForm.Load(new XmlTextReader(new StringReader(sr.ReadToEnd()))); Thats just a snippted to load in an .xsl file but you can use the same approach. Use .ReadToEnd() and pass that to your string to hold the data. XmlDocument.Load simply loads in the entire XML file into memory which then you can convert .ToString() as well.