New to Programming - XML Processing

Burak Arslan burak.arslan at arskom.com.tr
Wed Apr 1 15:44:02 CEST 2015


On 04/01/15 06:27, catperson wrote:
> I am new to programming, though not new to computers.  I'm looking to
> teach myself Python 3 and am working my way through a tutorial.  At
> the point I'm at in the tutorial I am tasked with parsing out an XML
> file created with a Garmin Forerunner and am just having a terrible
> time getting my head around the concepts.  What I'm looking for is
> some suggested reading that might give me some of the theory of
> operation behind ElementTree and then how to parse out specific
> elements.  Most of what I have been able to find in examples that I
> can understand use very simplistic XML files and this Garmin file is
> many levels of sub-elements and some of those elements have attributes
> assigned, like <Activity Sport="Running">.

As everybody loves objects, there are many libraries that parse xml
documents to regular python objects (with proper hierarchy). These are
supposed to save you from dealing with ElementTree api directly.

Have a look here:

http://stackoverflow.com/questions/19545067/python-joining-and-writing-xml-etrees-trees-stored-in-a-list

Hth,
Burak





More information about the Python-list mailing list