home HOME

XML DOM Tutorial
DOM HOME
DOM Introduction
DOM Nodes
DOM Node Tree
DOM Node Access
DOM Node Info
DOM Node List
DOM Parsing
DOM Traverse Nodes
DOM Mozilla vs IE
DOM Navigate Nodes

Manipulate Nodes
DOM Get Nodes
DOM Set Nodes
DOM Remove Nodes
DOM Replace Nodes
DOM Create Nodes
DOM Add Nodes
DOM Clone Nodes

XML DOM Reference
DOM Node Types
DOM Node
DOM NodeList
DOM NamedNodeMap
DOM Document
DOM DocumentImpl
DOM DocumentType
DOM ProcessingInstr
DOM Element
DOM Attribute
DOM Text
DOM CDATA
DOM Comment
DOM HttpRequest
DOM ParseError

DOM Summary

Examples
DOM Examples
DOM Validator

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Forum

Helping W3Schools

pixels

XML DOM Examples

prev next

XML DOM Parsing

The XML file used in the examples below: note.xml

Parse an XML file - Crossbrowser example
Parse an XML string - Crossbrowser example

Examples explained


XML DOM Traversing Nodes

The XML file used in the examples below: note.xml

Traverse a node tree

Examples explained


XML DOM Get Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Use getElementsbyTagname()
Use getAttribute()
Use getNamedItem()

Examples explained


XML DOM Set Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Set a new attribute and attribute value
Create a new attribute node
Change an attribute's value
Change an item's value

Examples explained


XML DOM Remove Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Remove an element
Remove text from a text node
Remove an attribute
Use removeAttributeNode()

Examples explained


XML DOM Replace Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Replace a node in a nodelist
Replace data in a text node

Examples explained


XML DOM Create Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Create an element node
Create an attribute node
Create a text node
Create a CDATA section node
Create a comment node

Examples explained


XML DOM Add Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Add a node to the end of a node list
Add a node before a specific node
Set a new attribute and attribute value
Insert data into a text node

Examples explained


XML DOM Clone Nodes

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().

Copy a node and add it to the node list

Examples explained


prev next

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2007 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999