[BangPypers] parsing xml
Anand Balachandran Pillai
abpillai at gmail.com
Sun Jul 31 16:27:49 CEST 2011
On Fri, Jul 29, 2011 at 4:41 PM, Venkatraman S <venkat83 at gmail.com> wrote:
> I have nothing more to say than this(as i see some tangential replies which
> i am not interested in substantiating - for eg, i never suggested to use a
> regexp based parser - a regexp based xml parser is different from using 'a'
> regexp on a string!!!!!) :
> Read my replies properly. Read my assumptions properly w.r.t the xml
> structure and the requested value in the xml. Read the link that you have
> pasted again. If possible, read the comments in the link shared(from esr)
> again. Once done, think twice and tell me which is better. If you vouch
> xml parsing in the case when all that you need from the string is a simple
> numeric value(not a string), then good luck; unlike esr i will not use
> adjectives; but i would not use your code either.
To be fair here, I think what he is saying is that Kenneth's problem
at the particular value) can be solved by using an aptly written regular
expression which might be the fastest - not in terms of CPU cycles alone,
but in terms of time to code it up - solution.
It is not impossible to write a regular expression which will work for
bad (invalid) XML as well.
Don't forget that a lot of XML/HTML parsers are actually implemented
using regular expressions. You can take a look at sgmllib.SGMLParser,
No complex text processing gets done without some kind of regular expression
behind the scenes.
> BangPypers mailing list
> BangPypers at python.org
More information about the BangPypers