New to Programming - XML Processing

Ben Finney ben+python at benfinney.id.au
Wed Apr 1 00:08:37 EDT 2015


catperson <me at anonymous.invalid> writes:

> 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.

Congratulations! Python 3 is a fine language to be your first.

Which tutorial are you following? It may be relevant.

> 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.

Have you worked with manipulating XML documents in the past?

If I describe XML as a machine-readable hierarchical data serialisation
format, does that sound like noise or are you comfortable that you
understand that description?

> 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.

You'll need to understand the principles behind XML, then. Warning: it
is not simple! XML is machine-readable, but rarely pleasant for *humans*
to read or understand.

> I'm hoping with enough reading I can experiment and work my way
> through the problem and end up with a hopefully clear understanding of
> the ElementTree module and Dictionairies.

XML is a standard – a large number of standards, really – from the W3
Consortium. They have a good overview of the “core” of XML
<URL:http://www.w3.org/standards/xml/core>.

There are countless XML formats though; XML is a markup language to use
as a basis for constructing data serialisation formats. You need to know
what the specific format (called a “schema”) is before you can expect to
make sense of it, and so in order to understand what's in the document
you need a description of the specific schema from whoever wrote the
document.

General XML tutorials do exist; here is one comprehensive one
<URL:http://www.xmlobjective.com/category/guide/>. You'll likely want to
learn more about the specifics of whatever XML format is being used,
though, before going much beyond the basic principles.

-- 
 \            “Politics is not the art of the possible. It consists in |
  `\       choosing between the disastrous and the unpalatable.” —John |
_o__)                                    Kenneth Galbraith, 1962-03-02 |
Ben Finney




More information about the Python-list mailing list