August 2002
Intermediate to advanced
944 pages
22h 32m
English
One of the powerful features of the DOM is the ability to manipulate the XML document in memory. Let’s now look at how to add, remove, and alter information in the DOM tree and how to write out the contents of the DOM once they’ve been changed.
The simplest thing you can do to alter the contents of a DOM tree is to delete part of it. The RemoveChild method of the XmlNode class allows you to remove a child of a given node. This operation will also delete any nodes below the given child. For example, the following code removes the first Sizes element in a CakeCatalog node together with the Option elements below it:
XmlElement root = doc.get_DocumentElement(); XmlNodeList nodes = root.GetElementsByTagName("Sizes", ...Read now
Unlock full access