[XML-SIG] pDomlette bug/non standard method?

Mike Olson Mike.Olson@fourthought.com
Mon, 24 Sep 2001 09:27:33 -0600


Alexandre Fayolle wrote:
> 
> On Mon, 24 Sep 2001, Alan Kernnedy wrote:
> 
> > According to the DOM spec, I should be able to acess the character
> > data in a text node through the attribute "nodeValue", which is what
> > my code used successfully with 4DOM, e.g
> >
> > myData = myTextNode.nodeValue
> >
> > Now, having examined the code, it appears that I have to use the
> > attribute "data", i.e. I access the contents of a text node using
> >
> > myData = myTextNode.data
> >
> > Am I missing something here?
> 
> Well, I'd say that this is part of the price to pay for the memory
> footprint decrease, and the speed improvement you get from switching from
> 4DOM to pDomlette (and it also explains the 'ette' at the end of
> pDomlette).

I agree with you Alexandre, but this specific use case should work.

Alan, what version of 4Suite are you using?


> 
> The idea is to get a DOM-like object structure, but not with all the
> features mentionned in the spec (which make the DOM very heavyweight).
> 
> To be more specific to the case at hand, nodeValue is an attribute of the
> Node interface, and data is an attribute of the CharacterData interface
> (the Text interface inherits from this interface, which in turn inherits
> from Node). pDomlette does not have a Node interface, and uses a pythonic
> Implicit Interface pattern instead for classes that should implement it.
> The consequence of this is that redundant methods/attributes are not
> implemented (you'd have to update both data and nodeValue when one of them
> is changed, or use __getattr__, and both of these have an impact on
> performance or memory usage.
> 
> Using data in 4DOM is safe (if you want to preserve compatibility with
> this DOM implementation), so I'd suggest you use data to get the contents
> of a Text node.
> 
> Alexandre Fayolle
> --
> LOGILAB, Paris (France).
> http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
> Narval, the first software agent available as free software (GPL).
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://mail.python.org/mailman/listinfo/xml-sig

-- 
Mike Olson                                Principal Consultant
mike.olson@fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St,                      http://4Suite.org
Boulder, CO 80301-2537, USA
XML strategy, XML tools, knowledge management