XmlNode Class Considerations

In general, the XmlNode Class methods and properties can be broken up into the following categories:

Category

Description

Add

The Addxxx methods add an entity of the specified type to the end of the list of child nodes, and returns a reference to the newly created node.

Insert

The Insertxxx methods insert an entity of the specified type at the specific location and returns a reference to the newly created node.

Get

The Getxxx methods return a reference to the specified entity. The Getxxx methods may return a single reference or an array of references.

Other

The other methods enable you to find a particular entity in an XmlDoc (FindNode), copy data from one node into another, and remove nodes.

If you're creating an XmlDoc object, use the CreateDocumentElement, as well as the different Add and Insert methods to create XmlNode objects. These methods return a reference to the newly created node if successful.

Use the XmlNode properties for traversing the data structure (ParentNode, PreviousSibling, NextSibling, and so on.)

You can also use the ChildNodeCount property for looping through all the child nodes of a node.

Use the NodeType property to get the type of the node (element, processing instruction, comment, and so on).