Issue lookupNamespaceURIAlgo-1 - proposed solution

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 UTC