Use python to process XML file

silverburgh.meryl at gmail.com silverburgh.meryl at gmail.com
Fri Mar 10 12:10:41 EST 2006


Hi,
Can you please tell me how Use python to process XML file?
The example I find is build a DOM, but I just need to do it in SAX
based, how can I do that?

For example, I have a xml file like this:
<log>
<a> text </a>
<a> text </a>
<b> text </b>
<a> text </a>
<c> text </c>
<a> text </a>
<b> text </b>
</log>

For i want to process the node in the order they appears.
If element name == 'a'
    do this
else If element name == 'b'
    do this
else If element name == 'c' 
    do this




More information about the Python-list mailing list