You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2001/11/02 21:32:54 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/dom AttrNSImpl.java AttributeMap.java CoreDOMImplementationImpl.java CoreDocumentImpl.java DOMImplementationImpl.java ElementNSImpl.java

elena       01/11/02 12:32:53

  Modified:    java/src/org/apache/xerces/dom AttrNSImpl.java
                        AttributeMap.java CoreDOMImplementationImpl.java
                        CoreDocumentImpl.java DOMImplementationImpl.java
                        ElementNSImpl.java
  Log:
  Fix some DOM L2 conformance bugs
  
  Revision  Changes    Path
  1.22      +5 -2      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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AttrNSImpl.java	2001/08/10 01:18:16	1.21
  +++ AttrNSImpl.java	2001/11/02 20:32:53	1.22
  @@ -1,4 +1,4 @@
  -/* $Id: AttrNSImpl.java,v 1.21 2001/08/10 01:18:16 lehors Exp $ */
  +/* $Id: AttrNSImpl.java,v 1.22 2001/11/02 20:32:53 elena Exp $ */
   /*
    * The Apache Software License, Version 1.1
    *
  @@ -224,7 +224,7 @@
                   throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 
       	                               "DOM002 Illegal character");
               }
  -            if (namespaceURI == null) {
  +            if (namespaceURI == null || prefix.indexOf(':') >=0) {
                   throw new DOMException(DOMException.NAMESPACE_ERR, 
   				       "DOM003 Namespace error");
               } else if (prefix != null) {
  @@ -238,6 +238,9 @@
                           throw new DOMException(DOMException.NAMESPACE_ERR, 
                                                  "DOM003 Namespace error");
                       }
  +                }else if (name.equals("xmlns")) {
  +                        throw new DOMException(DOMException.NAMESPACE_ERR,
  +                               "DOM003 Namespace error");
                   }
               }
           }
  
  
  
  1.15      +9 -0      xml-xerces/java/src/org/apache/xerces/dom/AttributeMap.java
  
  Index: AttributeMap.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/AttributeMap.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AttributeMap.java	2001/08/10 01:18:16	1.14
  +++ AttributeMap.java	2001/11/02 20:32:53	1.15
  @@ -385,6 +385,15 @@
                       if (j>=0 && findNamePoint(nodeName, j+1) < 0) {
                           NodeImpl clone = (NodeImpl)d.cloneNode(true);
                           clone.ownerNode = ownerNode;
  +                        // REVISIT: can we assume that if we reach here it is 
  +                        // always attrNSImpl
  +                        if (clone instanceof AttrNSImpl) {
  +                            // we must rely on the name to find a default attribute
  +                            // ("test:attr"), but while copying it from the DOCTYPE
  +                            // we should not loose namespace URI that was assigned
  +                            // to the attribute in the instance document.
  +                            ((AttrNSImpl)clone).namespaceURI = namespaceURI;
  +                        }
                           clone.isOwned(true);
                           clone.isSpecified(false);
                           nodes.setElementAt(clone, i);
  
  
  
  1.2       +3 -1      xml-xerces/java/src/org/apache/xerces/dom/CoreDOMImplementationImpl.java
  
  Index: CoreDOMImplementationImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDOMImplementationImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CoreDOMImplementationImpl.java	2001/08/10 01:18:16	1.1
  +++ CoreDOMImplementationImpl.java	2001/11/02 20:32:53	1.2
  @@ -156,7 +156,9 @@
       		                           "DOM002 Illegal character");
           }
           int index = qualifiedName.indexOf(':');
  -        if (index == 0 || index == qualifiedName.length() - 1) {
  +        int lastIndex = qualifiedName.lastIndexOf(':');
  +        // it is an error for NCName to have more than one ':'
  +        if (index == 0 || index == qualifiedName.length() - 1 || lastIndex!=index) {
   	    throw new DOMException(DOMException.NAMESPACE_ERR, 
   				       "DOM003 Namespace error");
   	}
  
  
  
  1.6       +3 -37     xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
  
  Index: CoreDocumentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CoreDocumentImpl.java	2001/10/17 20:50:05	1.5
  +++ CoreDocumentImpl.java	2001/11/02 20:32:53	1.6
  @@ -1019,42 +1019,8 @@
   		newnode = createComment(source.getNodeValue());
   		break;
               }
  -
  -            // REVISIT: The DOM specifications say that DocumentType nodes
  -            // cannot be imported. Is this OK?
  -    	    case DOCUMENT_TYPE_NODE: {
  -		DocumentType srcdoctype = (DocumentType)source;
  -		DocumentTypeImpl newdoctype = (DocumentTypeImpl)
  -		    createDocumentType(srcdoctype.getNodeName(),
  -				       srcdoctype.getPublicId(),
  -				       srcdoctype.getSystemId());
  -		// Values are on NamedNodeMaps
  -		NamedNodeMap smap = srcdoctype.getEntities();
  -		NamedNodeMap tmap = newdoctype.getEntities();
  -		if(smap != null) {
  -		    for(int i = 0; i < smap.getLength(); i++) {
  -			tmap.setNamedItem(importNode(smap.item(i), true,
  -                                                     reversedIdentifiers));
  -                    }
  -                }
  -		smap = srcdoctype.getNotations();
  -		tmap = newdoctype.getNotations();
  -		if (smap != null) {
  -		    for(int i = 0; i < smap.getLength(); i++) {
  -			tmap.setNamedItem(importNode(smap.item(i), true,
  -                                                     reversedIdentifiers));
  -                    }
  -                }
  -		// NOTE: At this time, the DOM definition of DocumentType
  -		// doesn't cover Elements and their Attributes. domimpl's
  -		// extentions in that area will not be preserved, even if
  -		// copying from domimpl to domimpl. We could special-case
  -		// that here. Arguably we should. Consider. ?????
  -		newnode = newdoctype;
  -		break;
  -            }
  -
  -    	    case DOCUMENT_FRAGMENT_NODE: {
  +    	    
  +        case DOCUMENT_FRAGMENT_NODE: {
   		newnode = createDocumentFragment();
   		// No name, kids carry value
   		break;
  @@ -1071,7 +1037,7 @@
   		// No name, no value
   		break;
               }
  -
  +            case DOCUMENT_TYPE_NODE: // can't import doctype nodes
               case DOCUMENT_NODE : // Can't import document nodes
               default: {           // Unknown node type
                   throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
  
  
  
  1.16      +3 -1      xml-xerces/java/src/org/apache/xerces/dom/DOMImplementationImpl.java
  
  Index: DOMImplementationImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/DOMImplementationImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DOMImplementationImpl.java	2001/08/10 01:18:16	1.15
  +++ DOMImplementationImpl.java	2001/11/02 20:32:53	1.16
  @@ -160,7 +160,9 @@
       		                           "DOM002 Illegal character");
           }
           int index = qualifiedName.indexOf(':');
  -        if (index == 0 || index == qualifiedName.length() - 1) {
  +        int lastIndex = qualifiedName.lastIndexOf(':');
  +        // it is an error for NCName to have more than one ':'
  +        if (index == 0 || index == qualifiedName.length() - 1 || lastIndex!=index) {
   	    throw new DOMException(DOMException.NAMESPACE_ERR, 
   				       "DOM003 Namespace error");
   	}
  
  
  
  1.17      +2 -2      xml-xerces/java/src/org/apache/xerces/dom/ElementNSImpl.java
  
  Index: ElementNSImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementNSImpl.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElementNSImpl.java	2001/08/10 01:18:16	1.16
  +++ ElementNSImpl.java	2001/11/02 20:32:53	1.17
  @@ -1,4 +1,4 @@
  -/* $Id: ElementNSImpl.java,v 1.16 2001/08/10 01:18:16 lehors Exp $ */
  +/* $Id: ElementNSImpl.java,v 1.17 2001/11/02 20:32:53 elena Exp $ */
   /*
    * The Apache Software License, Version 1.1
    *
  @@ -214,7 +214,7 @@
                   throw new DOMException(DOMException.INVALID_CHARACTER_ERR, 
       	                               "DOM002 Illegal character");
               }
  -            if (namespaceURI == null) {
  +            if (namespaceURI == null || prefix.indexOf(':') >=0) {
                     throw new DOMException(DOMException.NAMESPACE_ERR, 
                                            "DOM003 Namespace error");
               } else if (prefix != null) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org