XML DOM
DOM (Document Object Model) defines the standard methods for accessing and manipulating documents.
XML DOM
XML DOM (XML Document Object Model) defines the standard methods for accessing and manipulating XML documents.
XML DOM views an XML document as a tree structure.
All elements can be accessed through the DOM tree. Their content can be modified or deleted, and new elements can be created. Elements, their text, and their attributes are all considered nodes.
In our XML DOM Tutorial, you can learn more about the XML DOM.
HTML DOM
The HTML DOM defines the standard methods for accessing and manipulating HTML documents.
All HTML elements can be accessed through the HTML DOM.
In our HTML DOM Tutorial, you can learn more about the HTML DOM.
Loading an XML File - Cross-Browser Example
The following example parses the XML document ("note.xml") into an XML DOM object, and then extracts some information with JavaScript:
Example
W3Schools Internal Note
To:
From:
Message:
Try it »
Important Note!
To extract from the XML file above ("note.xml") the
getElementsByTagName("to")[0].childNodes[0].nodeValue
Please note that even if the XML file contains only one
Loading an XML String - Cross-Browser Example
The following example parses an XML string into an XML DOM object and then extracts some information with JavaScript:
Example
W3Schools Internal Note
To:
From:
Message:
Try it »