1

I am trying to parsing a very large xml file with python. I have tried several methods, but the way I found can't output each path from root to leaf. Is there any solution or tool to meet the output requirement below?

xml file example:

<node item='Top'>
  <node item='middle'>
    <node item='bottom'>
      <node item='A'>
      </node>
      <node item='B'>
      </node>
      <node item='C'>
      </node>
      <node item='D'>
      </node>
    </node>
  </node>
</node>

The output supposed to be:

Top middle bottom A
Top middle bottom B
Top middle bottom C
Top middle bottom D
Chris Chou
  • 832
  • 1
  • 6
  • 9
  • It might be worth checking out the `xml` module. There's some good examples here: https://stackoverflow.com/a/1912483/1277637 – mattjegan Aug 02 '17 at 03:04

0 Answers0