title: python error AttributeError: 'Element' object has no attribute 'childNodes' while parsing xml
body: <p>I very very new to python world .im having a new requirement that I need to print the node value along with node name in python.but im getting some error.
  can any one help me pls...!!!!</p>
  
  <p>This is my sample xml:  </p>
  
  <pre><code>  &lt;task chapnbr="05" sectnbr="41" subjnbr="05" func="210" seq="8" pgblknbr="2" chg="N" key="4B5014E906" revdate="20051230"&gt;
        &lt;effect effrg="801899" efftext="ZAP ALL" /&gt;
        &lt;title&gt;WING&lt;/title&gt;
        &lt;refblock&gt;(&lt;grphcref refid=NAX00000&gt;Figure 208&lt;/grphcref&gt;)&lt;/refblock&gt;
        &lt;tfmatr&gt;
          &lt;pretopic&gt;
            &lt;title&gt;General&lt;/title&gt;
            &lt;list1&gt;
              &lt;l1item&gt;
                &lt;para&gt;This procedure is a scheduled maintenance task.&lt;/para&gt;
              &lt;/l1item&gt;
            &lt;/list1&gt;
          &lt;/pretopic&gt;
        &lt;/tfmatr&gt;
        &lt;topic&gt;
          &lt;title&gt;Zonal Inspection&lt;/title&gt;
          &lt;subtask chapnbr="05" sectnbr="41" subjnbr="05" func="210" seq="008" pgblknbr="2" chg="N" key="B7A276D9D" revdate="20051230"&gt;
            &lt;effect effrg="8018" efftext="ZAP ALL" /&gt;
            &lt;list1&gt;
              &lt;l1item&gt;
                &lt;para&gt;Do the zonal inspection.&lt;/para&gt;
              &lt;/l1item&gt;
            &lt;/list1&gt;
          &lt;/subtask&gt;
        &lt;/topic&gt;
        &lt;graphic chapnbr="05" sectnbr="41" subjnbr="05" func="990" seq="808" pgblknbr="2" chg="N" key=NAX00000 revdate="20051230"&gt;
          &lt;effect effrg="801899" efftext="ZAP ALL" /&gt;
          &lt;title&gt;Figure 208. Leading Edge to Front Spar (Outboard of Nacelle Strut) Left Wing - General Visual (External)&lt;/title&gt;
          &lt;sheet gnbr="811DE0C" sheetnbr="1" chg="N" key="5C152" revdate="20051230"&gt;
            &lt;effect effrg="801899" efftext="ZAP ALL" /&gt;
          &lt;/sheet&gt;
        &lt;/graphic&gt;
      &lt;/task&gt;
  </code></pre>
  
  <p>my sample python code :</p>
  
  <pre><code>import os
  import sys
  import xml.etree.ElementTree as ET
  
  
  directory=raw_input("Enter the folderPath : ")
  files=raw_input("Enter the File type : ")
  
  def select_files_in_folder(dir, ext):
      for file in os.listdir(dir):
          if file.endswith('.%s' % ext):
              yield os.path.join(dir, file)
  
  def print_node(root):
      if root.childNodes[0]:
          for node in root.childNodes:
             if node.nodeType == node.ELEMENT_NODE:
                 print node.tagName,"has value:",  node.nodeValue, "and is child of:", node.parentNode.tagName
                 print_node(node)
  
  for file in select_files_in_folder(directory, files):
      tree = ET.parse(file)
      root = tree.getroot()
      print_node(root)
  </code></pre>
  
  <p>Im getting below error.</p>
  
  <p><a href="https://i.stack.imgur.com/KRmAc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KRmAc.png" alt="enter image description here"></a></p>