elena       2002/08/16 12:28:37

  Modified:    java/src/org/apache/xerces/dom AttrNSImpl.java
  Log:
  According to the latest Namespace in XML erratum no other prefix other that
   "xmlns" can be bound to the xmlns namespace.
  DOM L3 createAttributeNS() throws an exception in this case.
  
  Revision  Changes    Path
  1.31      +11 -9     xml-xerces/java/src/org/apache/xerces/dom/AttrNSImpl.java
  
  Index: AttrNSImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/AttrNSImpl.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AttrNSImpl.java   9 Aug 2002 15:18:13 -0000       1.30
  +++ AttrNSImpl.java   16 Aug 2002 19:28:37 -0000      1.31
  @@ -113,19 +113,21 @@
       {
           int index = qualifiedName.indexOf(':');
           String prefix;
  -
           // DOM Level 3: namespace URI is never empty string.
           this.namespaceURI = (namespaceURI !=null &&
                                namespaceURI.length() == 0) ? null : namespaceURI;
  +        
  +        
           if (index < 0) {
               prefix = null;
               localName = qualifiedName;
  -
  -            if (ownerDocument().errorChecking &&
  -                qualifiedName.equals("xmlns") &&
  -                (namespaceURI == null || !namespaceURI.equals(xmlnsURI))) {
  +            if (ownerDocument().errorChecking) {
  +                if ( qualifiedName.equals("xmlns") &&
  +                (namespaceURI == null || !namespaceURI.equals(xmlnsURI)) ||
  +                     (namespaceURI !=null && namespaceURI.equals(xmlnsURI) && 
!qualifiedName.equals("xmlns"))) {
                   String msg = 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", 
null);
                   throw new DOMException(DOMException.NAMESPACE_ERR, msg);
  +                }
               }
           }
           else {
  @@ -143,11 +145,11 @@
                           String msg = 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", 
null);
                           throw new DOMException(DOMException.NAMESPACE_ERR, msg);
                       }
  -                } else if (prefix.equals("xmlns")) {
  -                    if (!namespaceURI.equals(xmlnsURI)) {
  +                } else if (prefix.equals("xmlns") && !namespaceURI.equals(xmlnsURI) 
||
  +                           (!prefix.equals("xmlns") && namespaceURI != null && 
  +                            namespaceURI.equals(xmlnsURI))) {
                           String msg = 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", 
null);
                           throw new DOMException(DOMException.NAMESPACE_ERR, msg);
  -                    }
                   } else if (index == 0) {
                       String msg = 
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", 
null);
                       throw new DOMException(DOMException.NAMESPACE_ERR, msg);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to