Creating XML Trees with the XmlTextWriter and XmlDocument Objects - Linking Out
(Page 7 of 7 )
And that's about it. Over the last few pages, I gave you an introduction to the XmlTextWriter object, which allows you to write XML using straightforward syntax, and showed you how to use it to create a well-formed XML file. This was followed by a set of examples using the XmlDocument object. As you have already seen, this object is designed to read an XML file, build a tree to represent the structures found within it, and expose object methods and properties to manipulate them. Today, I extended your understanding of this object and showed how you can use it to create a DOM tree in memory using the different methods available in the .NET framework.
Each example demonstrated the concept of creating nodes, and how to use the DOM to build an XML document right from the root element to any child node at any depth. The examples also addressed the issue of dynamically adding attributes and CDATA to your XML tree, showing you how to add these important XML constructs to your DOM trees.
You can read more about the XmlTextWriter object at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlTextWriterClassTopic.asp, and the XMLDocument object at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlDocumentClassTopic.asp.
Until next time...see ya!
Note: Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |