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

Andrew Clover and at doxdesk.com
Tue Aug 17 03:44:53 CEST 2004


Ajay <abra9823 at mail.usyd.edu.au> wrote:

> the statement attribs.getNamedItem("appel:connective") however returns
> None.

Oh dear me. This is issue 20 from:

   http://pyxml.sourceforge.net/topics/compliance.html

Which I believed had been fixed in PyXML 0.7, but apparently not; 
certainly I can see the problem again in 0.8.3.

Using namespace-unaware methods to access attributes which have 
namespaces just doesn't seem to work in 4DOM. That's quite bad really.

> now i think its substituting the namespace for appel but then how would you
> access the attribute, just 'connective' doesn't work, 'appel:connective'
> doesn't either and http://www.w3.org/2001/02/appelv1:connective doesn't
> work either.

You'd need one of the DOM Level 2 namespace-aware methods for this:

attrs.getNamedItemNS('http://www.w3.org/2001/02/appelv1', 'connective')
element.getAttribute('http://www.w3.org/2001/02/appelv1', 'connective')

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/


More information about the XML-SIG mailing list