Author: veithen
Date: Thu Apr 12 18:54:50 2012
New Revision: 1325444
URL: http://svn.apache.org/viewvc?rev=1325444&view=rev
Log:
More code for AXIOM-412.
Modified:
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Modified:
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1325444&r1=1325443&r2=1325444&view=diff
==============================================================================
---
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
(original)
+++
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
Thu Apr 12 18:54:50 2012
@@ -188,10 +188,14 @@ public class AttrImpl extends NodeImpl i
return owner instanceof ElementImpl ? (Element)owner : null;
}
- void setOwnerElement(ElementImpl element) {
+ void setOwnerElement(ElementImpl element, boolean useDomSemantics) {
if (element == null) {
if (owner instanceof ElementImpl) {
- owner = ((ElementImpl)owner).ownerDocument();
+ if (useDomSemantics) {
+ owner = ((ElementImpl)owner).ownerDocument();
+ } else {
+ owner = null;
+ }
}
} else {
owner = element;
Modified:
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java?rev=1325444&r1=1325443&r2=1325444&view=diff
==============================================================================
---
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
(original)
+++
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
Thu Apr 12 18:54:50 2012
@@ -140,7 +140,7 @@ public class AttributeMap implements Nam
// same element
}
- attr.setOwnerElement((ElementImpl)this.ownerNode); // Set the owner
node
+ attr.setOwnerElement((ElementImpl)this.ownerNode, true); // Set the
owner node
attr.setUsed(true); // Setting used to true
int i = findNamePoint(attr.getNodeName(), 0);
@@ -149,7 +149,7 @@ public class AttributeMap implements Nam
if (i >= 0) { // There's an attribute already with this attr's name
previous = (AttrImpl) nodes.elementAt(i);
nodes.setElementAt(attr, i);
- previous.setOwnerElement(null);
+ previous.setOwnerElement(null, true);
// make sure it won't be mistaken with defaults in case it's reused
previous.isSpecified(true);
@@ -171,11 +171,11 @@ public class AttributeMap implements Nam
public Node setNamedItemNS(Node attribute) throws DOMException {
ownerNode.checkSameOwnerDocument(attribute);
- return setAttribute(attribute);
+ return setAttribute(attribute, true);
}
/** Almost a copy of the Xerces impl. */
- Node setAttribute(Node attribute) throws DOMException {
+ Node setAttribute(Node attribute, boolean useDomSemantics) throws
DOMException {
if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
DOMException.HIERARCHY_REQUEST_ERR,
@@ -196,7 +196,7 @@ public class AttributeMap implements Nam
// same element
}
//Set the owner node
- attr.setOwnerElement((ElementImpl)this.ownerNode);
+ attr.setOwnerElement((ElementImpl)this.ownerNode, useDomSemantics);
int i = findNamePoint(attr.getNamespaceURI(), attr.getLocalName());
AttrImpl previous = null;
@@ -204,7 +204,7 @@ public class AttributeMap implements Nam
if (i >= 0) {
previous = (AttrImpl) nodes.elementAt(i);
nodes.setElementAt(attr, i);
- previous.setOwnerElement(null);
+ previous.setOwnerElement(null, useDomSemantics);
// make sure it won't be mistaken with defaults in case it's reused
previous.isSpecified(true);
} else {
@@ -253,7 +253,7 @@ public class AttributeMap implements Nam
AttrImpl clone = (AttrImpl) n.cloneNode(true);
clone.isSpecified(n.isSpecified());
nodes.setElementAt(clone, i);
- clone.setOwnerElement(ownerNode);
+ clone.setOwnerElement(ownerNode, true);
}
}
}
@@ -432,9 +432,9 @@ public class AttributeMap implements Nam
}
}
- void remove(AttrImpl attr) {
+ void remove(AttrImpl attr, boolean useDomSemantics) {
if (nodes.remove(attr)) {
- attr.setOwnerElement(null);
+ attr.setOwnerElement(null, useDomSemantics);
}
}
}
Modified:
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1325444&r1=1325443&r2=1325444&view=diff
==============================================================================
---
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++
webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Thu Apr 12 18:54:50 2012
@@ -337,7 +337,7 @@ public class ElementImpl extends ParentN
DOMMessageFormatter.DOM_DOMAIN,
DOMException.NOT_FOUND_ERR, null);
throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
}
- attributes.remove((AttrImpl)oldAttr);
+ attributes.remove((AttrImpl)oldAttr, true);
return oldAttr;
}
@@ -525,7 +525,7 @@ public class ElementImpl extends ParentN
attr.getPrefix()));
}
- return (Attr) this.attributes.setAttribute(attr);
+ return (Attr) this.attributes.setAttribute(attr, useDomSemantics);
}
}
@@ -976,7 +976,7 @@ public class ElementImpl extends ParentN
if (attr.getOwner() != this) {
throw new OMException("The attribute is not owned by this
element");
}
- attributes.remove((AttrImpl)attr);
+ attributes.remove((AttrImpl)attr, false);
}
/**