title: How to extract data from XML using python minidom
body: <p>given this xml file, i would like to extract the data out from it. However, i have trouble extracting the data from <code>&lt;LandmarkPointListXml&gt;</code> onwards.</p>
  
  <p><strong>The XML file:</strong></p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;Map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;MapName&gt;er&lt;/MapName&gt;
    &lt;MapURL&gt;er.gif&lt;/MapURL&gt;
    &lt;Name&gt;er&lt;/Name&gt;
    &lt;URL&gt;er.gif&lt;/URL&gt;
    &lt;LandmarkPointListXml&gt;
      &lt;anyType xsi:type="LandmarkPointProperty"&gt;
        &lt;LandmarkPointX&gt;400&lt;/LandmarkPointX&gt;
        &lt;LandmarkPointY&gt;292&lt;/LandmarkPointY&gt;
        &lt;LandmarkDesc&gt;my room door&lt;/LandmarkDesc&gt;
      &lt;/anyType&gt;
      &lt;anyType xsi:type="LandmarkPointProperty"&gt;
        &lt;LandmarkPointX&gt;399&lt;/LandmarkPointX&gt;
        &lt;LandmarkPointY&gt;219&lt;/LandmarkPointY&gt;
        &lt;LandmarkDesc&gt;bro room door&lt;/LandmarkDesc&gt;
      &lt;/anyType&gt;
    &lt;/LandmarkPointListXml&gt;
    &lt;RegionPointListXml /&gt;
  &lt;/Map&gt;
  </code></pre>
  
  <p><strong>Python program:</strong></p>
  
  <pre><code>    def GetMapData(self):
          result = ""
          haha = self.XMLdoc.firstChild #root node
          for child in haha.childNodes:
              if (cmp(child.nodeName,'LandmarkPointListXml')==0):
                  result = result + '|' + self.loopLandmark(child.childNodes) + '|'
              else:
                  result = result + child.firstChild.nodeValue + ','
          return result
  
      def loopLandmark(self, landmarks):
          result=""
          haha=landmarks.getElementsByTagName('anyType')
          for child in haha.childNodes:
              if (cmp(haha.firstChild.nodeName,'LandmarkPointX') == 0):
                  result=result+child.firstChild.nodeValue+','
                  ChildNode = ChildNode.nextSibling
                  result=result+child.firstChild.nodeValue+','
                  ChildNode = ChildNode.nextSibling
                  result=result+child.firstChild.nodeValue
          return result
  </code></pre>
  
  <p>I was able to retrieve the result, "er,er.gif,er,er.gif," till the program reaches <code>&lt;LandmarkPointListXml&gt;</code>.</p>