[Tutor] Parse XML file

marc at Marcd.org marc at Marcd.org
Sun Mar 15 16:25:27 CET 2009


> Message: 5
> Date: Sun, 15 Mar 2009 10:56:22 +0100
> From: Stefan Behnel <stefan_ml at behnel.de>
> Subject: Re: [Tutor] Parse XML file
> To: tutor at python.org
> Message-ID: <gpijc7$6uo$1 at ger.gmane.org>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Lukas Agrapidis wrote:
>> I am trying to parse an XML file using Python and found this resource
http://diveintopython.org/xml_processing/parsing_xml.html
>
> You might be interested in ElementTree:
>
> http://effbot.org/zone/element.htm
>
> It's a lot easier to use than minidom, especially for new users. It's
available in the standard library as "xml.etree.ElementTree" module
since
> Python 2.5.
>

I would agree - I was struggling with minidom, Stefan recommended
ElementTree and another person (deleted the email and can't recall his
name) recommended lxml.  I was able to get a working understanding of
these libraries in less than an hour and solve the problems I had
encountered with minidom in a very short time. (BTW, parsing xml was
probably a poor choice for my first project while learning Python, but
then again, nobody has ever accused me of making my life easy)

Marc





More information about the Tutor mailing list