XML DOM Example
XML DOM Parsing
The following example uses the XML file books.xml.
Load an XML FileLoad an XML String
XML DOM Properties and Methods
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file. loadXMLString(), in an external JavaScript, is used to load the XML string.
Load and Parse XML File - External Parser ScriptLoad and Parse XML String - External Parser Script
XML DOM Access Nodes
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Access Nodes Using Index Numbers from Node ListLoop Through Nodes Using the Length PropertyCheck the Node Type of an ElementLoop Through Element NodesLoop Through Element Nodes Using Node Relationships
XML DOM Node Information
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Get the Node Name of an Element NodeGet Text from a Text NodeChange Text in a Text NodeGet the Node Name and Type of an Element Node
XML DOM Node List and Attribute List
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Get Text from the First <title> ElementLoop Through Nodes Using the Length PropertyGet Attributes of an Element
XML DOM Traverse Node Tree
The following example uses the XML file books.xml. loadXMLString(), in an external JavaScript, is used to load the XML string.
XML DOM Browser Differences
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Show the Length of the Node List - Different Results in IE and Other BrowsersIgnore Whitespace Between Nodes
XML DOM Navigate Nodes
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Get the Parent Node of a NodeGet the First Child Element of a NodeGet the Last Child Element of a NodeGet the Next Sibling Element of a NodeGet the Previous Sibling Element of a Node
XML DOM Get Node Value
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Get the Text Value of an ElementGet the Text Value of an Attribute
XML DOM Change Node Value
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Change the Text Node of an ElementChange Attribute Value Using setAttributeChange Attribute Value Using nodeValue
XML DOM Remove Nodes
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Remove Element NodesRemove the Current Element NodeRemove Text NodesClear the Text of a Text NodeRemove Attributes by NameRemove Attributes by Object
XML DOM Replace Nodes
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Replace Element NodesReplace Data in a Text Node
XML DOM Create Nodes
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Create Element NodesCreate Attribute Nodes Using createAttributeCreate Attribute Nodes Using setAttributeCreate Text NodesCreate CDATA Section NodesCreate Comment Nodes
XML DOM Add Nodes
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file. Add a Node After the Last Child NodeAdd a Node Before a Specified Child NodeAdd a New AttributeAppend Data to a Text Node
XML DOM Clone Node
The following example uses the XML file books.xml. loadXMLDoc(), in an external JavaScript, is used to load the XML file.
Clone a Node and Append it to an Existing Node
XML DOM XMLHttpRequest Object
A Simple XMLHttpRequest Example
Retrieve Header Information with getAllResponseHeaders()
Retrieve Specified Header Information with getResponseHeader()
Retrieve Content of an ASP File
Retrieve Content from a Database