troubleshooting Question

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

Avatar of sapbucket
sapbucket asked on
2 Comments1 Solution3587 ViewsLast Modified:

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);

                  // write here: ??



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!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros