Document object Model (DOM) is foundation of XML. It is tree based information called nodes; it is a way of describing those nodes and the relationship between them. A DOM is said to be tree based. A DOM document is a collection of nodes organized in hierarchy. The hierarchy allows the developers to navigate through the tree to looking for specific information. In XML DOM it provides an API to developer to add, edit, move or remove nodes in tree at any place in order to create the application. Example

<!DOCTYPE html>  
        <h1> tutorialandexample </h1>  
            <b>Name:</b> <span id="name"></span><br>  
            <b>Company:</b> <span id="company"></span><br>  
            <b>Phone:</b> <span id="phone"></span><br>  
            If  (window.XMLHttpRequest)  
            {// code for IE7+, Firefox, chrome, Opera, Safari   
                xmlhttp = new XMLHttpRequest ();  
            {// code for IE6, IE5  
                xmlhttp = new Activexobject("Microsoft.XMLHTTP");  
            xmlDoc.getElementsByTagName("name") [0].childnodes[0].nodevalue;  
            xmlDoc.getElementsByTagName("phone") [0].childnodes[0].nodevalue;  
In above example (sample.html) parses an XML document ("address.html") into a XML DOM object and then extracts some information from it with JavaScript. Contents of address.xml
<?xml version="1.0"?>  
    <name>Ajay Singh</name>  
    <company> SSSIT Pvt.Ltd</company>  
    <phone>0120-4256464, 9990449935</phone>  

Program execute

Keep these two files sample.htm and address.xml in same directory and execute the sample.html by opening it in browser and see the output.