[XML-SIG] help - attributes namespace - is this a bug in PyXML

Uche Ogbuji uche.ogbuji at fourthought.com
Thu Aug 19 21:41:42 CEST 2004


On Mon, 2004-08-16 at 20:38, Ajay wrote:
> 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.

I suggest 4Suite.  It has a very fast DOM (Domlette), and a very good
XPath impl (the one in PyXML is a much older version of 4Suite's
XPath).  It does use some C code (so does PyXML, though), so bear that
in mind for future porting thoughts.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Decomposition, Process, Recomposition - http://www.xml.com/pub/a/2004/07/28/py-xml.html
Perspective on XML: Steady steps spell success with Google - http://www.adtmag.com/article.asp?id=9663
Managing XML libraries - http://www.adtmag.com/article.asp?id=9160
Commentary on "Objects. Encapsulation. XML?" - http://www.adtmag.com/article.asp?id=9090
Harold's Effective XML - http://www.ibm.com/developerworks/xml/library/x-think25.html
A survey of XML standards - http://www-106.ibm.com/developerworks/xml/library/x-stand4/



More information about the XML-SIG mailing list