how to create a xml and write to a string variable?
Hi,
I am trying to create a customized xml doc and save it to a string, so I can send it out by socket.
However, I did not see sample in xmlwriter to do it (I don't want to create a file at the local). Can anyone show me what would be the best way to do it?
Thanks a lot
Chris
string xmlString = xmlDom.ToString();
Hi all,
I just wanted to mention that the toString method is going to produce this output:
System.Xml.XmlDocument
instead of the xml document itself.
Instead you should use toString of StringWriter after you close it.
This way it works fine but that way it writes the XML declaration with version attribute set to "1.0" which I don't want since I want to store the string in database.
Here's my question:
Is it possible use the XMLTextWriter without having it create
<?xml version="1.0" encoding="utf-16"?>
element?
Thanks in advance...