[XML-SIG] Re: [Twisted-Python] Can anyone recommend a sensible XML parser for Python?

Fred L. Drake, Jr. fdrake at acm.org
Sat Sep 7 03:14:40 EDT 2002


Uche Ogbuji writes:
 > You see, this is why reporting such "bugs" early is helpful.  I could have 
 > told you ages ago that it is a *bad* idea to call cloneNode on a Document 
 > object.
 > 
 > Accordin to the DOM Level 2 spec:
 > 
 > "And, cloning Document, DocumentType, Entity, and Notation nodes is 
 > implementation dependent."

That's no reason to think its a bad idea to implement it or need it,
just that you can't rely on it being supported by an arbitrary DOM
implementation.

 > I do agree that the confused error message is a glitch.  Current PyXML CVS 
 > gives a more straightforward "sod off"  :-)

Not quite; the previous message would have been raised calling
cloneNode() on a processing instruction as well.  Or calling it with
deep=1 on a portion of the tree that contained a processing
instruction.  That was a real bug, and not an arbitrary limitation.

 > We choose not to allow it.  Perfectly legal, and I think this is the right 
 > choice.

Honestly, I think we should implement cloneNode() for Document, simply
because not doing so seems an unnecessary limitation.  It is not for
the library to decide what is right for the application.

I agree that not supporting it is legal.  The exception that is raised
is wrong: it should be xml.dom.NotSupportedErr.

 > If you try going this route, I guarantee you'll still be trying to get the 
 > most basic things right six months from now.

Heck, we're still trying to get Expat right, and it isn't exactly the
freshest software around!

 > This is the impetus for the Python-in-a-tie effort for Python
 > proper.  I do think we'd make a lot more friends if there were a
 > matching PyXML-in-a-tie.  It would mean companies would have to

That would be nice to have.  First task:  improve & integrate all the
random piles of tests out there!  They should all be run when I type
"make check" at the top level, not just a handful.

 > You pointed out one problem in cloneNode which, from what I gather,
 > was mostly because you're abusing DOM.  This had nothing to do with

It is not at all clear that this is an abuse of the DOM, as I
explained above.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation




More information about the Twisted-Python mailing list