XML Parsing

Paul McGuire ptmcg at austin.rr.com
Thu Feb 26 16:11:08 CET 2009


You flatter me sir (or madam? can't tell from your name...), but I wouldn't
presume to so lofty a title among this crowd.  I'd save that for the likes
of Alan Gauld and Kent Johnson, who are much more prolific  and informative
contributors to this list than I.

-- Paul


-----Original Message-----
From: hrishy [mailto:hrishys at yahoo.co.uk] 
Sent: Wednesday, February 25, 2009 11:36 PM
To: python-list at python.org; Paul McGuire
Subject: Re: XML Parsing

Ha the guru himself responding :-)


--- On Wed, 25/2/09, Paul McGuire <ptmcg at austin.rr.com> wrote:

> From: Paul McGuire <ptmcg at austin.rr.com>
> Subject: Re: XML Parsing
> To: python-list at python.org
> Date: Wednesday, 25 February, 2009, 2:04 PM On Feb 25, 1:17 am, hrishy 
> <hris... at yahoo.co.uk>
> wrote:
> > Hi
> >
> > Something like this
> >
> <snip solution using ElementTree>
> >
> > Note i am not a python programmer just a enthusiast
> and i was curious why people on the list didnt suggest a code like 
> above
> >
> 
> You just beat the rest of us to it - good example of ElementTree for 
> parsing XML (and I Iearned the '//' shortcut for one or more 
> intervening tag levels).
> 
> To the OP: if you are parsing XML, I would look hard at the modules 
> (esp. ElementTree) that are written explicitly for XML, before 
> considering using regular expressions.  There are just too many 
> potential surprises when trying to match XML tags - presence/absence/ 
> order of attributes, namespaces, whitespace inside tags, to name a 
> few.
> 
> -- Paul
> --
> http://mail.python.org/mailman/listinfo/python-list


      




More information about the Python-list mailing list