[XML-SIG] 2 identical namespaces and getElementByTagNameNS
Andrew Clover
and-xml at doxdesk.com
Tue Sep 9 19:58:14 EDT 2003
Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote:
> Right now I've had to use some regex's to parse the raw xml and figure out
> the namepsace prefix in order to accomplish this. It's kind of ugly.
> There are getAttributeNS functions in DOM 2, but they didn't help so I have
> to assume they work on things like gml:type="value" ...
I'm not entirely sure what you mean here, but if you're trying to read an
attribute's qualified name without namespace processing, you'll want the
normal DOM Level 1 non-NS methods, eg. getAttribute. These treat qualified
names as if the colon character were nothing special. Also you could look
at an attribute's 'prefix' property, which should accurately reflect the
string before the ':'.
The trick is that older versions of minidom lost track of which prefix was
which when there were two prefixes having the same namespace URI. This
would indeed get in your way here! It's listed as bug 9 at:
http://pyxml.sf.net/topics/compliance.html
(Or bug 8 if you're reading this in the same hour I posted it, I've only
just added a couple of new ones. :-) )
The solution is either to upgrade to the latest minidom (included in PyXML
0.8.3), or use a different DOM (4DOM, the 4Suite Domlettes and pxdom don't
suffer from this one).
--
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/
More information about the XML-SIG
mailing list