[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-cvs
Subject:    cvs commit: xml-xerces/java/src/org/apache/xerces/dom AttrImpl.java ElementImpl.java NamedNodeMapImp
From:       lehors () locus ! apache ! org
Date:       2000-03-31 2:51:52
[Download RAW message or body]

lehors      00/03/30 18:51:52

  Modified:    java/src/org/apache/xerces/dom AttrImpl.java
                        ElementImpl.java NamedNodeMapImpl.java
  Log:
  got rid of the owned flag on AttrImpl, use parentNode instead
  
  Revision  Changes    Path
  1.11      +5 -8      xml-xerces/java/src/org/apache/xerces/dom/AttrImpl.java
  
  Index: AttrImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/AttrImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AttrImpl.java	2000/03/16 18:47:33	1.10
  +++ AttrImpl.java	2000/03/31 02:51:51	1.11
  @@ -88,10 +88,11 @@
    * (see the INUSE exception), so this object's mutability is
    * officially not an issue.
    * <p>
  - * Note: Attributes do not have parent nodes. In other words, the
  - * getParentNode() method is defined to return null for Attr nodes.
  - * However, the getElement() method will return the element node
  - * that this attribute is associated with.
  + * Note: The parentNode attribute is used to store the Element the Attr
  + * node is associated with. However, Attr nodes do not have parent nodes. So,
  + * the getParentNode() method is defined to return null for Attr nodes.
  + * Besides, the getOwnerElement() method can be used to get the element node
  + * this attribute is associated with.
    * <P>
    * AttrImpl does not support Namespaces. AttrNSImpl, which inherits from
    * it, does.
  @@ -115,9 +116,6 @@
       // Data
       //
   
  -    /** Flag used for INUSE exception processing. */
  -    protected boolean owned;
  -
       /** False for default attributes. */
       protected boolean specified = true;
     
  @@ -177,7 +175,6 @@
       /** Clone node. */
       public Node cloneNode(boolean deep) {
           AttrImpl newattr = (AttrImpl)super.cloneNode(deep);
  -        newattr.owned = false;
           newattr.specified = specified;
           return newattr;
       }
  
  
  
  1.16      +4 -11     xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java
  
  Index: ElementImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ElementImpl.java	2000/03/31 02:17:08	1.15
  +++ ElementImpl.java	2000/03/31 02:51:52	1.16
  @@ -336,8 +336,7 @@
       	AttrImpl att = (AttrImpl) attributes.getNamedItem(name);
       	// Remove it (and let the NamedNodeMap recreate the default, if any)
       	if (att != null) {
  -    		att.owned = false;
  -    		attributes.removeNamedItem(name);
  +            attributes.removeNamedItem(name);
       	}
   
       } // removeAttribute(String)
  @@ -379,9 +378,8 @@
       	// NamedNodeMap recreate the default, if any)
   
       	if (found == oldAttr) {
  -    		attributes.removeNamedItem(oldAttr.getName());
  -    		found.owned = false;
  -    		return found;
  +            attributes.removeNamedItem(oldAttr.getName());
  +            return found;
       	}
   
           throw new DOMExceptionImpl(DOMException.NOT_FOUND_ERR, 
  @@ -425,7 +423,6 @@
           if (newAttr == null) {
               newAttr = (AttrImpl) getOwnerDocument().createAttribute(name);
               attributes.setNamedItem(newAttr);
  -            newAttr.owned = true;
           }
       	newAttr.setNodeValue(value);
   
  @@ -468,7 +465,6 @@
   
       	// This will throw INUSE if necessary
       	attributes.setNamedItem(na);
  -    	na.owned = true; // Must set after adding ... or within?
   
       	return oldAttr;
   
  @@ -560,7 +556,6 @@
               newAttr = (AttrImpl)
                   getOwnerDocument().createAttributeNS(namespaceURI, localName);
               attributes.setNamedItemNS(newAttr);
  -            newAttr.owned = true;
       	}
       	newAttr.setNodeValue(value);
   
  @@ -596,8 +591,7 @@
       	AttrImpl att = (AttrImpl) attributes.getNamedItemNS(namespaceURI, localName);
       	// Remove it (and let the NamedNodeMap recreate the default, if any)
       	if (att != null) {
  -    		att.owned = false;
  -    		attributes.removeNamedItemNS(namespaceURI, localName);
  +            attributes.removeNamedItemNS(namespaceURI, localName);
       	}
   
       } // removeAttributeNS(String,String)
  @@ -673,7 +667,6 @@
   
       	// This will throw INUSE if necessary
       	attributes.setNamedItem(na);
  -    	na.owned = true; // Must set after adding ... or within?
   
       	return oldAttr;
   
  
  
  
  1.9       +2 -7      xml-xerces/java/src/org/apache/xerces/dom/NamedNodeMapImpl.java
  
  Index: NamedNodeMapImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/NamedNodeMapImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NamedNodeMapImpl.java	2000/03/16 18:30:09	1.8
  +++ NamedNodeMapImpl.java	2000/03/31 02:51:52	1.9
  @@ -272,7 +272,7 @@
                                          "DOM005 Wrong document");
           }
   
  -    	if (arg instanceof AttrImpl && ((AttrImpl)arg).owned) {
  +    	if (arg instanceof AttrImpl && ((AttrImpl)arg).parentNode != null) {
               throw new DOMExceptionImpl(DOMException.INUSE_ATTRIBUTE_ERR,
                                          "DOM009 Attribute already in use");
           }
  @@ -344,7 +344,7 @@
                                          "DOM005 Wrong document");
           }
   
  -    	if (arg instanceof AttrImpl && ((AttrImpl)arg).owned) {
  +    	if (arg instanceof AttrImpl && ((AttrImpl)arg).parentNode != null) {
               throw new DOMExceptionImpl(DOMException.INUSE_ATTRIBUTE_ERR,
                                          "DOM009 Attribute already in use");
           }
  @@ -514,14 +514,9 @@
   
           // Need to remove references to an Attr's owner before the
           // MutationEvents fire.
  -        // ***** We really don't need a seperate "owned" flag; we
  -        // could instead test for parentNode!=null... or alternatively,
  -        // and perhaps better, we could replace owned with ownerElement
  -        // and avoid overloading parentNode as owner.
           if (element != null) {
               AttrImpl attr=(AttrImpl)n;
               attr.parentNode = null;
  -            attr.owned=false;
           }
   
           ++changes;
  
  
  

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic