title: how to extract values from an XML document using Javascript
body: <p>I am trying to extract values from the xml document and print them.
  I also want to count the number of children(child nodes)
  each node has.That is the first  tag has 2 child and second  tag has 3.</p>
  
  <p>THIS IS THE XML DOCUMENT</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt; 
    &lt;A&gt;
    &lt;a1&gt;a1&lt;/a1&gt; 
    &lt;a2&gt;a2&lt;/a2&gt; 
    &lt;B&gt;
    &lt;C&gt;2&lt;/C&gt; 
    &lt;C&gt;3&lt;/C&gt; 
    &lt;/B&gt;
    &lt;B&gt;
    &lt;C&gt;4&lt;/C&gt; 
    &lt;C&gt;5&lt;/C&gt; 
    &lt;C&gt;6&lt;/C&gt;
    &lt;/B&gt;
    &lt;/A&gt;
  </code></pre>
  
  <p>THIS IS MY JAVASCRIPT DOCUMENT</p>
  
  <pre><code>if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
  else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  xmlhttp.open("GET","extractexample.xml",false);
  xmlhttp.send();
  xmlDoc=xmlhttp.responseXML;
  xmlObj=xmlDoc.documentElement;
  document.write(xmlDoc.getElementsByTagName("B")[0].childNodes[0].nodeValue);
  </code></pre>