[XML-SIG] finding the NS URI for a prefix in a DOM

Fred L. Drake, Jr. fdrake@acm.org
Fri, 19 Jul 2002 11:29:34 -0400


Alexandre writes:
 > I have a silly DOM question. I'm using 4DOM on this one, but this may
 > change later. 
 > 
 > What is the best way of finding the nsuri of a namespace given a prefix
 > to which the nsuri could be mapped?

My own preference would be to use the lookupNamespaceURI() method on a
node, but that would imply we have a Level 3 DOM.  I suspect that
minidom will eventually provide this in some form.  ;-)

I don't think we have a good way to do that now, but it could be done
in a DOM-independent way by walking up the tree looking at namespace
declarations.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation