[XML-SIG] Incompatible and bugs

Alexandre Fayolle Alexandre.Fayolle@logilab.fr
Fri, 17 Nov 2000 14:56:59 +0100 (CET)


On Fri, 17 Nov 2000, Bastian Kleineidam wrote:

> 2) All DOM functions have changed?

Yes, the dom implementation in pyXML changed. It's now 4DOM, by
Fourthought, Inc. 4DOM is part of 4Suite, which features many other libs
(xpath, xslt... see http://www.4suite.org for details).

>    I was formerly using the SaxBuilder class to build a DOM tree.
>    Document.get_documentElement() does not exist any more
>    Node.get_attributes does not exist
>    Node.get_value does not exist
>    and so on
>    
>    Where can I find those functions?
>    It seems that every function has a leading underscore, so its
>    now _get_value etc.?

Well you can do so, since it gains some performance over the method I'm
about to explain. The DOM spec says 'attributes' is an attribute of the
interface. Java and C++ implementations will map these to accessor
methods. 4DOM simply uses python attributes, so you may want can use
Node.attributes or Node.value, Document.documentElement to achiev the
same thing (please note that these are direct references to the attribute,
and not function calls). For a detailed specification of the API, check
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html  


> 3) The documentation suggests to use xml.dom.ext.reader.Sax2.FromXml,
>    but in the source it is marked as deprecated.
> 
>    What functions should I use then to build DOM trees? If you mark
>    something deprecated you should also write what the new functions 
>    are.

You can still use the Sax2.FromXml function for now. If you want to avoid
problems later, the issue was discussed in this list, see
http://www.python.org/pipermail/xml-sig/2000-November/005267.html 


To output the tree as text you can use xml.dom.ext.Print or
xml.dom.ext.PrettyPrint

Alexandre Fayolle
-- 
http://www.logilab.com 
Narval is the first software agent available as free software (GPL).
LOGILAB, Paris (France).