ElementTree - Howto access text within XML tag element...

cmalmqui cmalmqui at gmail.com
Tue Aug 11 01:54:38 EDT 2009


Hi,

I am writing on a small XML parser and are currently stuck as I am not
able to get the whole element name in ElementTree.

Please see the below example where "print root[0][0]" returns
"<Element 'Activity' at 018A3938>"

Is there a way to get hold of the "Running" string in the tag using
elementTree?

<Activities>
    <Activity Sport="Running">
      <Id>2009-07-10T14:48:00Z</Id>
      <Lap StartTime="2009-07-10T14:48:00Z">
      .........

For those of you that know how to program XML I have another
question:
I am currently "hardcoding" my XML parser using brackets, is this a
good approach or should I build it using a "search on tag" approach.

Thank you for any answers!



More information about the Python-list mailing list