ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1324897 - in /webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom: AttributeMap.java ElementImpl.java
Date Wed, 11 Apr 2012 18:06:31 GMT
Author: veithen
Date: Wed Apr 11 18:06:30 2012
New Revision: 1324897

URL: http://svn.apache.org/viewvc?rev=1324897&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/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/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=1324897&r1=1324896&r2=1324897&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
Wed Apr 11 18:06:30 2012
@@ -169,9 +169,13 @@ public class AttributeMap implements Nam
 
     }
 
-    /** Almost a copy of the Xerces impl. */
     public Node setNamedItemNS(Node attribute) throws DOMException {
         ownerNode.checkSameOwnerDocument(attribute);
+        return setAttribute(attribute);
+    }
+    
+    /** Almost a copy of the Xerces impl. */
+    Node setAttribute(Node attribute) throws DOMException {
         if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
             String msg = DOMMessageFormatter.formatMessage(
                     DOMMessageFormatter.DOM_DOMAIN, DOMException.HIERARCHY_REQUEST_ERR,

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=1324897&r1=1324896&r2=1324897&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
Wed Apr 11 18:06:30 2012
@@ -486,12 +486,11 @@ public class ElementImpl extends ParentN
 
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
-     */
     public Attr setAttributeNodeNS(Attr attr) throws DOMException {
+        return setAttributeNodeNS(attr, true);
+    }
+    
+    private Attr setAttributeNodeNS(Attr attr, boolean useDomSemantics) throws DOMException
{
 
         // Check whether the attr is a namespace declaration
         // if so add a namespace NOT an attribute
@@ -502,7 +501,9 @@ public class ElementImpl extends ParentN
         } else {
             AttrImpl attrImpl = (AttrImpl) attr;
 
-            checkSameOwnerDocument(attr);
+            if (useDomSemantics) {
+                checkSameOwnerDocument(attr);
+            }
 
             // check whether the attr is in use
             if (attrImpl.isUsed()) {
@@ -526,7 +527,7 @@ public class ElementImpl extends ParentN
                                                         attr.getPrefix()));
             }
 
-            return (Attr) this.attributes.setNamedItemNS(attr);
+            return (Attr) this.attributes.setAttribute(attr);
         }
     }
 
@@ -671,7 +672,8 @@ public class ElementImpl extends ParentN
             if (owner == this) {
                 return attr;
             }
-            attr = (OMAttribute)((AttrImpl)attr).cloneNode(false);
+            attr = new AttrImpl(null, attr.getLocalName(), attr.getNamespace(),
+                    attr.getAttributeValue(), attr.getOMFactory());
         }
         
         OMNamespace namespace = attr.getNamespace();
@@ -686,7 +688,7 @@ public class ElementImpl extends ParentN
             }
         }
 
-        this.setAttributeNodeNS((Attr) attr);
+        this.setAttributeNodeNS((Attr) attr, false);
         return attr;
     }
 



Mime
View raw message