Groups | Blog | Home
all groups > dotnet xml > june 2005 >

dotnet xml : From DOM to an XML string


Pascal Schmitt
6/15/2005 12:00:00 AM
Hello!

[quoted text, click to view]


What about InnerXml? (see
<http://msdn2.microsoft.com/library/tx0xzte7(en-us,vs.80).aspx>)

You could also use a StringWriter and Save the XmlDocument to it.


--
Martin Honnen
6/15/2005 12:00:00 AM


[quoted text, click to view]

If you have a .NET XmlDocument (or any .NET XML node) you can simply
access the property
MyXMLDoc.OuterXml
to have the serialized markup as a string.



--

Martin Honnen --- MVP XML
ChuckD_Duncan
6/15/2005 1:00:59 PM
I know this is too easy for you heavy-weights but I am drowning in streams
and writers ..., I have created an XmlDocument containing all my nodes and
attributes. I just need to do something like:

string XmlString = MyXMLDoc.MakeXmlString();

Ok... so what do I really have to do... I started by building a memory
stream which I figured I could convert to a string, but then couldn't
figure out out to get XmlWriter hooked up to write through that stream.

Thanks in advance.
Chuck Duncan
AddThis Social Bookmark Button