Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to append elements in an xml file?

Status
Not open for further replies.

vcllvc

Programmer
Jul 12, 2001
136
US
how to append elements into an xml file?
 
How big a file?
Less than 500kb?

This is because you have two options in reading XML files in .net - you can use a XmlDocument or an XmlReader/XmlWriter.

The XmlDocument is way easier, but since it loads the entire file into memory (and constructs an in-memory tree representation of your document) it's slow and consumes a lot of memory. So it's best used for files less that 500kb or so (that's just a number I made up - your experience may indicate a different one). You would load the file into your XmlDocument, and append your new nodes using CreateElement and AppendChild methods.

The XmlReader/XmlWriter are actually abstract base classes - you'll actually need to instantiate one of XmlTextReader, XmlValidatingReader, or XmlNodeReader. In the case of a writer, you'll use XmlTextWriter.

See:

and


Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top