[XML-SIG] 2 identical namespaces and getElementByTagNameNS

Jean-Francois.Doyon at CCRS.NRCan.gc.ca Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Tue Sep 9 10:33:37 EDT 2003


Andrew,

Thanks, but I figured it out, turns out there was a slight problem with the
code right on the same expression.

Oh, and it is minidom :)

On a similar topic, is there any smart way to handle attribute values that
are qualified ?

Say I have a Schema attribute type="gml:AbstractFeatureType" ... And I want
to look for the element containing an attribute for that value.

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" ...

Is there any better way to do this ?

Thanks,
J.F.

-----Original Message-----
From: Andrew Clover [mailto:and-xml at doxdesk.com]
Sent: Tuesday, September 09, 2003 3:39 AM
To: xml-sig at python.org
Subject: Re: [XML-SIG] 2 identical namespaces and getElementByTagNameNS


Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote:

> Now if I use getElementByTagNameNS with "http://www.w3.org/2001/XMLSchema"
> as the namespace on a document where the elements are named into the
default
> namespace, I don't get the expected results, presumably because PyXML
> expects that name space to have the "xsd:" prefix ...

I don't know whether you're talking about minidom or 4DOM, but both work
for me in at least 0.8.0 and 0.8.3. If I take your example <schema>
root element and insert:

  <a/>
  <xsd:b/>

I can retrieve either element using getElementsByTagNameNS.

Can you give more example context/code, where an unexpected result occurs?

-- 
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



More information about the XML-SIG mailing list