title: How to parse multi-level XML file with python
body: <p>I have a multi-level XML file that needs to parse with python, I have xml or lxml. How do I parse? I could not find any useful solution.Please help me, thanks a lot! Ideally, I want to parse the XML file and convert to Python DataFrame.
  This for loop does not work.</p>
  
  <pre><code> for child in root:
       for element in child:
           for element in child:
               print(element.tag, element.attrib)
  </code></pre>
  
  <p>This is part of the result that I printed out with pretty print.</p>
  
  <pre><code>&lt;Listings&gt;
    &lt;Listing&gt;
      &lt;Location&gt;
        &lt;City&gt;Amagansett&lt;/City&gt;
        &lt;State&gt;NY&lt;/State&gt;
        &lt;Zip&gt;11930&lt;/Zip&gt;
        &lt;Latitude&gt;4.12&lt;/Latitude&gt;
        &lt;Longitude&gt;2.13&lt;/Longitude&gt;
        &lt;DisplayAddress&gt;No&lt;/DisplayAddress&gt;
      &lt;/Location&gt;
      &lt;ListingDetails&gt;
        &lt;Status&gt;For Rent&lt;/Status&gt;
        &lt;Price&gt;120000&lt;/Price&gt;
        &lt;ListingUrl&gt;http://www.co.com/listing.aspx?   Region=LI3&amp;amp;ListingID=122&lt;/ListingUrl&gt;
        &lt;MlsId&gt;122&lt;/MlsId&gt;
        &lt;DateListed&gt;2011-06-10&lt;/DateListed&gt;
        &lt;NewDevelopment&gt;N&lt;/NewDevelopment&gt;
      &lt;/ListingDetails&gt;
      &lt;BasicDetails&gt;
        &lt;PropertyType&gt;Other&lt;/PropertyType&gt;
        &lt;Description&gt;Rental Registration #: the master suite has a lavish bath and its own terrace with small ocean views..&lt;/Description&gt;
        &lt;Bedrooms&gt;5&lt;/Bedrooms&gt;
        &lt;Bathrooms&gt;4&lt;/Bathrooms&gt;
        &lt;FullBathrooms&gt;4&lt;/FullBathrooms&gt;
        &lt;HalfBathrooms&gt;0&lt;/HalfBathrooms&gt;
        &lt;LivingArea&gt;5775&lt;/LivingArea&gt;
        &lt;LotSize&gt;0.8&lt;/LotSize&gt;
      &lt;/BasicDetails&gt;
  
    &lt;/Listing&gt;
  &lt;/Listings&gt;
  </code></pre>