W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Issue lookupNamespaceURIAlgo-1 - proposed solution

From: Stefan Wachter <Stefan.Wachter@gmx.de>
Date: Sat, 2 Mar 2002 09:07:10 -0500 (EST)
Message-ID: <3C80DCB2.9010908@gmx.de>
To: www-dom@w3.org
Dear all!

Issue lookupNamespaceURIAlgo-1:
How does one look for the default namespace?


I propose the following addition to the namespace lookup algorithm: If 
the specifiedPrefix  parameter is null then the default namespace is to 
be looked up:

DOMString Element.lookupNamespaceURI(in DOMString specifiedPrefix)
{
   return lookupNamespaceURI(specifiedPrefix, this);
}

DOMString Element.lookupNamespaceURI(in DOMString specifiedPrefix, Element el)
{
   if ( Element's namespace URI != null and
        Element's prefix == specifiedPrefix and
        el.lookupNamespacePrefix(Element's namespace URI) == specifiedPrefix )
   {
        return Element's namespace URI
   }

/* ======= Start addition ====== */

   else if ( specifiedPrefix == null and
             Element has an Attr without namespace and
             Attr's name == "xmlns" )
   {
        return Attr's value
   }

/* ========End addition ======== */


   else if ( Element has an Attr and
             Attr's namespaceURI == "http://www.w3.org/2000/xmlns/" and
             Attr's prefix == "xmlns" and
             Attr's localName == specifiedPrefix and
         el.lookupNamespacePrefix(Attr's value URI) == specifiedPrefix )
   {
        return Attr's value.
   }
   else if ( Element has an ancestor Element )
            // EntityReferences may have to be skipped to get to it
   {
        return ancestorElement.lookupNamespaceURI(specifiedPrefix, el)
   }
   else {
        return unknown (null)
   }
}
     

-- Stefan
Received on Wednesday, 13 March 2002 16:56:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT