[XML-SIG] help - attributes namespace - is this a bug in PyXML
Ajay
abra9823 at mail.usyd.edu.au
Tue Aug 17 04:38:00 CEST 2004
no, there isn't any particular feature of 4DOM that i need.
the problem though seems that i can't use xpath in PyXML with a document
parsed using xml.dom.minidom
the following piece of code
dataNodes = xpath.Evaluate(".//*[local-name()='DATA']",document.documentEle
ment)
works perfectly fine when i pass in a document parsed using
document = reader.fromStream(open("test.xml", 'r'))
however when i pass a document parsed using minidom i get the following
exception
File "C:\PYTHON23\Lib\site-packages\_xmlplus\xpath\__init__.py", line 70,
in E
valuate
retval = parser.new().parse(expr).evaluate(con)
File
"C:\PYTHON23\Lib\site-packages\_xmlplus\xpath\ParsedAbbreviatedRelativeLo
cationPath.py", line 52, in evaluate
res = Set.Union(res,subRt)
File "C:\PYTHON23\Lib\site-packages\_xmlplus\xpath\Set.py", line 25, in
Union
return compare + filter(lambda x,compare = compare:x not in
compare,loop)
TypeError: can only concatenate list (not "tuple") to list
i would actually prefer using just minidom and not even have xpath. the
application may be ported to a PDA and the pythonce distribution does not
include the PyXML package.
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
that?
on the PyXML documentation page under the section on compliance issues, it
says
"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
working
efficiency and a future port to a PDA are the reasons why i didn't use
pxdom. that and being a newbie meant i knew very little about the
different packages.
thanks
cheers
> Alternatively both minidom and pxdom do a bit better with namespaces in
> general and allow access to DOM Level 1 and 2 methods at the same time.
> Is there a particular feature of 4DOM you need?
>
> --
> Andrew Clover
> mailto:and at doxdesk.com
> http://www.doxdesk.com/
> _______________________________________________
> XML-SIG maillist - XML-SIG at python.org
> http://mail.python.org/mailman/listinfo/xml-sig
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the XML-SIG
mailing list