Advertisement

08.18.2005 at 11:33AM PDT, ID: 21532026
[x]
Attachment Details

Have XmlDocument in memory, How to Write to .xml file?

Asked by sapbucket in C# Programming Language

Tags: xmldocument, write, file

Hello,

I have an:
XmlDocument doc = ClassSerializer.Serialize(_myClass); // i wrote ClassSerializer, it works great...

which works fine: i have [XmlElement()] and [XmlIgnore] attribute tags inside _myClass. So the doc exists in memory just fine, I can use XPath on it, etc. This is all possible because of "using System.Xml.Serialization;" Yah for the framework!

However, how do I write the silly thing to a text document?

For example: (this is how far I got before I became confused)

                  XmlDocument doc = ClassSerializer.Serialize(_myClass);

                  XmlTextWriter textWriter = new XmlTextWriter("C:\\myXmFile.xml", null);
                  textWriter.WriteStartDocument();

                  // write here: ??


                  textWriter.WriteEndDocument();

                  textWriter.Close();


Any help would be appreciated. I need this solution ASAP, so 500 points is warranted :)

There were several other questions of the same order on EE, but the solutions were expired links...bad page editor, you!Start Free Trial
 
Loading Advertisement...
 
[+][-]08.18.2005 at 12:09PM PDT, ID: 14703426

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.18.2005 at 12:20PM PDT, ID: 14703518

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C# Programming Language
Tags: xmldocument, write, file
Sign Up Now!
Solution Provided By: sapbucket
Participating Experts: 1
Solution Grade: B
 
 
[+][-]08.19.2005 at 09:22AM PDT, ID: 14710720

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32