You are viewing a plain text version of this content. The canonical link for it is here.
Posted to crimson-cvs@xml.apache.org by ed...@apache.org on 2001/01/23 21:32:45 UTC
cvs commit: xml-crimson/src/org/apache/crimson/tree AttributeNode.java AttributeSet.java
edwingo 01/01/23 12:32:43
Modified: src/org/apache/crimson/tree AttributeNode.java
AttributeSet.java
Log:
Allow cloned Attr nodes to be added to other Element nodes
Revision Changes Path
1.2 +9 -4 xml-crimson/src/org/apache/crimson/tree/AttributeNode.java
Index: AttributeNode.java
===================================================================
RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/tree/AttributeNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AttributeNode.java 2000/11/23 01:53:35 1.1
+++ AttributeNode.java 2001/01/23 20:32:31 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: AttributeNode.java,v 1.1 2000/11/23 01:53:35 edwingo Exp $
+ * $Id: AttributeNode.java,v 1.2 2001/01/23 20:32:31 edwingo Exp $
*
* The Apache Software License, Version 1.1
*
@@ -100,7 +100,7 @@
*
* @author David Brownell
* @author Rajiv Mordani
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
final // at least for the moment
// public
@@ -109,7 +109,11 @@
private String value;
private boolean specified;
private String defaultValue;
+
+ /** At construction time ownerElement is null, it gets set whenever an
+ attribute is set on an ElementNode */
private Element ownerElement;
+
private static final String
SPEC_XML_URI = "http://www.w3.org/XML/1998/namespace";
private static final String
@@ -291,7 +295,9 @@
}
}
- /** DOM: returns a copy of this node */
+ /**
+ * DOM: returns a copy of this node which is not owned by an Element
+ */
public Node cloneNode(boolean deep) {
AttributeNode attr = cloneAttributeNode(deep);
// DOM says specified should be true
@@ -307,7 +313,6 @@
try {
AttributeNode attr =
new AttributeNode(name, value, specified, defaultValue);
- attr.ownerElement = ownerElement;
attr.setOwnerDocument((XmlDocument)getOwnerDocument());
if (deep) {
Node node;
1.4 +5 -8 xml-crimson/src/org/apache/crimson/tree/AttributeSet.java
Index: AttributeSet.java
===================================================================
RCS file: /home/cvs/xml-crimson/src/org/apache/crimson/tree/AttributeSet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AttributeSet.java 2001/01/22 22:18:12 1.3
+++ AttributeSet.java 2001/01/23 20:32:35 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: AttributeSet.java,v 1.3 2001/01/22 22:18:12 edwingo Exp $
+ * $Id: AttributeSet.java,v 1.4 2001/01/23 20:32:35 edwingo Exp $
*
* The Apache Software License, Version 1.1
*
@@ -75,11 +75,11 @@
* Class representing a list of XML attributes.
*
* <P> This couples slightly with the Sun XML parser, in that it optionally
- * uses an extended SAX 1.0 API to see if an attribute was specified in the
+ * uses an extended SAX API to see if an attribute was specified in the
* document or was instead defaulted by attribute processing.
*
* @author David Brownell
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
final
class AttributeSet implements NamedNodeMap, XmlWritable
@@ -97,7 +97,8 @@
/*
* Constructs a copy of an attribute list, for use in cloning.
- * ownerElement is set separately.
+ * AttributeNode.ownerElement is set later when the attributes are
+ * associated with an Element.
*/
// package private
AttributeSet (AttributeSet original, boolean deep)
@@ -114,10 +115,6 @@
AttributeNode attr = (AttributeNode)node;
node = attr.cloneAttributeNode(deep);
-
- // temporarily undo binding to element ... it's rebound
- // by the caller
- attr.setOwnerElement(null);
list.addElement (node);
}
}