0% found this document useful (0 votes)
19 views2 pages

XML Dom

Uploaded by

mayankdevsingh4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

XML Dom

Uploaded by

mayankdevsingh4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

XML DOM Tutorial

❮ PreviousNext ❯

XML DOM

What is the DOM?


The DOM defines a standard for accessing and manipulating documents:

"The W3C Document Object Model (DOM) is a platform and language-neutral interface
that allows programs and scripts to dynamically access and update the content,
structure, and style of a document."

The HTML DOM defines a standard way for accessing and manipulating HTML documents.
It presents an HTML document as a tree-structure.

The XML DOM defines a standard way for accessing and manipulating XML documents. It
presents an XML document as a tree-structure.

Understanding the DOM is a must for anyone working with HTML or XML.

The HTML DOM


All HTML elements can be accessed through the HTML DOM.
This example changes the value of an HTML element with id="demo":

Example
<h1 id="demo">This is a Heading</h1>

<script>
document.getElementById("demo").innerHTML = "Hello World!";
</script

The XML DOM


All XML elements can be accessed through the XML DOM.

The XML DOM is:

 A standard object model for XML


 A standard programming interface for XML

 Platform- and language-independent

 A W3C standard

In other words: The XML DOM is a standard for how to get, change, add, or delete
XML elements.

Get the Value of an XML Element


This code retrieves the text value of the first <title> element in an XML document:

Example
txt = xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;

Try it Yourself »

You might also like