[XML-SIG] help - attributes namespace - is this a bug in PyXML
and-xml at doxdesk.com
Fri Aug 20 06:08:51 CEST 2004
Ajay <abra9823 at mail.usyd.edu.au> wrote:
> the problem though seems that i can't use xpath in PyXML with a document
> parsed using xml.dom.minidom
> dataNodes = xpath.Evaluate(".//*[local-name()='DATA']", doc.documentElement)
> TypeError: can only concatenate list (not "tuple") to list
Weird, works for me (0.8.3, even back to 0.6.6), and I can't see any
reason why the Union method might be getting a tuple instead of a list
> since i use xpath to just locate node subsets, i would have to rewrite
> funtions to do that by just looping through the different nodes (i don't
> know how hard that will be) --- is there someone who has already done
Sounds pretty easy to me; your example could be implemented as
documentElement.getElementsByTagNameNS('*', 'DATA'). List comprehensions
can also simplify looking through childNodes; anything doing a depth
search will need a few trivial recursive functions.
> "Never gets the attribute - always returns false for hasAttribute, empty
> string for getAttribute, or null for getAttributeNode."
> funny. i should have read that before trying hours on why my calls weren't
Well quite, similar frustrations led me to compile it!
That one's a bug from old versions of cDomlette though, shouldn't affect
4DOM. The calls fail in 4DOM under a more limited set of circumstances;
I've updated the table to add bug 20 to the latest 4DOM too as per your
> efficiency and a future port to a PDA are the reasons why i didn't use
Well, a PDA port shouldn't be a problem - pxdom is pure-Python
(compatible back to 1.5.2). Of course for efficiency as you say it's
cDomlette is the best option for efficiency, but has C parts so would
need suitable recompiling. It has a decent XPath too. Support for DOM
features is deliberately very limited so don't expect to be able to move
an arbitrary DOM application to it without change.
mailto:and at doxdesk.com
More information about the XML-SIG