f



XML documentation stinks - help?

I'm sure this must be a PEP, but could someone look at the PyXML
documentation?

I'm trying to evaluate XML on Python (to eventually use it with
XML-RPC) as apposed to Perl.

The problem is, I can't find a simple demo or documentation that just
says how to create a parser object, and call the start/char/end event
handlers.

With Perl's XML::Parser, it's that simple, you overload a
start/char/end handler that gets called for every element, then you
just create a hash of the data or whatever you want.

Most of the sites I Googled don't even exist anymore or have either
incomplete documentation, out-of-date documentation, or have way
over-complex examples that don't even explain why their importing
modules or what they're doing.

Maybe I'm missing something, but even comp.lang.python.* seems to have
no topics on XML in the past 3 years or so - has XML been deprecated
and I've not heard about it yet?! ;o)

I never thought I'd see something that is easy to do in Perl, but
seemingly impossible to do in Python, I guess Perl is optimised for
text parsing....

0
9/1/2004 3:32:18 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

2 Replies
360 Views

Similar Articles

[PageSpeed] 50

Simon John wrote:

> I'm sure this must be a PEP, but could someone look at the PyXML
> documentation?
> 
> I'm trying to evaluate XML on Python (to eventually use it with
> XML-RPC) as apposed to Perl.
> 
> The problem is, I can't find a simple demo or documentation that just
> says how to create a parser object, and call the start/char/end event
> handlers.
> 
> With Perl's XML::Parser, it's that simple, you overload a
> start/char/end handler that gets called for every element, then you
> just create a hash of the data or whatever you want.
> 
> Most of the sites I Googled don't even exist anymore or have either
> incomplete documentation, out-of-date documentation, or have way
> over-complex examples that don't even explain why their importing
> modules or what they're doing.

Did the Python/XML HOWTO not meet your needs?

http://pyxml.sourceforge.net/topics/howto/xml-howto.html

Note Chapter 5 on the SAX API, which looks like what you describe. It 
seems to be fairly straightforward to me.

-- 
Robert Kern
rkern@ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter
0
rkern (680)
9/1/2004 3:51:15 AM
    Simon> I'm trying to evaluate XML on Python (to eventually use it with
    Simon> XML-RPC) as apposed to Perl.

There is no need that I'm aware of to understand how Python deals with XML
to use XML-RPC.  There is already an xmlrpclib module that hides all XML
details from its users, though to speed things up a bit I urge you to
install Fredrik Lundh's sgmlop module if you decide to use xmlrpclib.  Maybe
if you can describe what you mean by "use it with XML-RPC" we can help you
avoid XML nitty gritty altogether.

    Simon> Maybe I'm missing something, but even comp.lang.python.* seems to
    Simon> have no topics on XML in the past 3 years or so - has XML been
    Simon> deprecated and I've not heard about it yet?! ;o)

XML is no panacea.  I'm sure most of the denizens of c.l.py realize that and
keep their distance when they can. ;-)

Skip
0
skip133 (2030)
9/1/2004 4:05:51 PM
Reply: