code: public String getNamespaceForPrefix(String prefix)
    {
  //    if (null != prefix && prefix.equals("xmlns"))
  //    {
  //      return Constants.S_XMLNAMESPACEURI;
  //    }
  
      List nsDecls = m_declaredPrefixes;
  
      if (null != nsDecls)
      {
        int n = nsDecls.size();
        if(prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX))
        {
          prefix = "";
        }
  
        for (int i = 0; i < n; i++)
        {
          XMLNSDecl decl = (XMLNSDecl) nsDecls.get(i);
  
          if (prefix.equals(decl.getPrefix()))
            return decl.getURI();
        }
      }
  
      // Not found; ask our ancestors
      if (null != m_parentNode)
        return m_parentNode.getNamespaceForPrefix(prefix);
  
      // JJK: No ancestors; try implicit
      // %REVIEW% Are there literals somewhere that we should use instead?
      // %REVIEW% Is this really the best place to patch?
      if("xml".equals(prefix))
        return "http://www.w3.org/XML/1998/namespace";
  
      // No parent, so no definition
      return null;
    }
docs: Given a namespace, get the corrisponding prefix.
  9/15/00: This had been iteratively examining the m_declaredPrefixes
  field for this node and its parents. That makes life difficult for
  the compilation experiment, which doesn't have a static vector of
  local declarations. Replaced a recursive solution, which permits
  easier subclassing/overriding.
  
  @param prefix non-null reference to prefix string, which should map
  to a namespace URL.
  
  @return The namespace URL that the prefix maps to, or null if no
  mapping can be found.