XML DOM Example

The following examples use an XML file books.xml.

XML DOM loads XML

Accessing Nodes in XML DOM

Example explanation: Access a node

XML DOM Node Information

Example explanation: Node information

XML DOM node list and attribute list

Example explanation: Node list

XML DOM Traversing the Node Tree

Example explanation: Traverse the node tree

Locating Nodes in XML DOM

Example explanation: Locate a node

XML DOM Getting Node Value

Example explanation: Get node value

XML DOM Changing Node Value

Example explanation: Change node value

Deleting Nodes in XML DOM

Example explanation: Delete a node

Replacing Nodes in XML DOM

Example explanation: Replace a node

Creating Nodes in XML DOM

Example explanation: Create a node

Adding Nodes in XML DOM

Example Explanation: Add Node

Cloning Nodes in XML DOM

Example Explanation: Clone Node