ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1611917 - in /webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom: AttrImpl.java ChildNode.java ParentNode.java
Date Sat, 19 Jul 2014 14:29:40 GMT
Author: veithen
Date: Sat Jul 19 14:29:40 2014
New Revision: 1611917

URL: http://svn.apache.org/r1611917
Log:
Some code cleanup.

Modified:
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1611917&r1=1611916&r2=1611917&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
Sat Jul 19 14:29:40 2014
@@ -76,7 +76,7 @@ public class AttrImpl extends RootNode i
             }
         }
         internalSetLocalName(localName);
-        internalAppendChild(new TextImpl(value, factory));
+        coreAppendChild(new TextImpl(value, factory), false);
         this.type = OMConstants.XMLATTRTYPE_CDATA;
         internalSetNamespace(ns);
     }
@@ -85,7 +85,7 @@ public class AttrImpl extends RootNode i
                     OMFactory factory) {
         this(ownerDocument, factory);
         internalSetLocalName(name);
-        internalAppendChild(new TextImpl(value, factory));
+        coreAppendChild(new TextImpl(value, factory), false);
         this.type = OMConstants.XMLATTRTYPE_CDATA;
     }
 
@@ -270,11 +270,7 @@ public class AttrImpl extends RootNode i
      * @see org.w3c.dom.Attr#setValue(String)
      */
     public void setValue(String value) throws DOMException {
-        Node child;
-        while ((child = getFirstChild()) != null) {
-            removeChild(child);
-        }
-        internalAppendChild((TextImpl)getOwnerDocument().createTextNode(value));
+        setTextContent(value);
     }
 
     /**

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java?rev=1611917&r1=1611916&r2=1611917&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
Sat Jul 19 14:29:40 2014
@@ -55,7 +55,7 @@ public abstract class ChildNode extends 
         beforeClone(options);
         ChildNode clone = createClone();
         if (targetParent != null) {
-            targetParent.internalAppendChild(clone);
+            targetParent.coreAppendChild(clone, false);
         }
         return clone;
     }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1611917&r1=1611916&r2=1611917&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
Sat Jul 19 14:29:40 2014
@@ -37,14 +37,6 @@ public abstract class ParentNode extends
     }
 
     // /
-    // /OMContainer methods
-    // /
-
-    void internalAppendChild(NodeImpl node) {
-        insertBefore(node, null, false);
-    }
-    
-    // /
     // /DOM Node methods
     // /
 
@@ -100,16 +92,10 @@ public abstract class ParentNode extends
      * last child.
      */
     public Node insertBefore(Node newChild, Node refChild) throws DOMException {
-        return insertBefore(newChild, refChild, true);
-    }
-    
-    private Node insertBefore(Node newChild, Node refChild, boolean useDomSemantics) {
         NodeImpl newDomChild = (NodeImpl) newChild;
         NodeImpl refDomChild = (NodeImpl) refChild;
 
-        if (useDomSemantics) {
-            checkSameOwnerDocument(newDomChild);
-        }
+        checkSameOwnerDocument(newDomChild);
 
         if (isAncestorOrSelf(newChild)) {
             throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
@@ -127,7 +113,7 @@ public abstract class ParentNode extends
                     throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
                 }
                 if (newDomChild.parentNode() == null) {
-                    newDomChild.setParent(this, useDomSemantics);
+                    newDomChild.setParent(this, true);
                 }
             } else if (!(newDomChild instanceof CommentImpl
                     || newDomChild instanceof ProcessingInstructionImpl
@@ -145,7 +131,7 @@ public abstract class ParentNode extends
             if (coreGetLastKnownChild() == null && coreGetFirstChildIfAvailable()
== null) {
                 coreSetLastChild((CoreChildNode)newDomChild);
                 coreSetFirstChild((CoreChildNode)newDomChild);
-                newDomChild.setParent(this, useDomSemantics);
+                newDomChild.setParent(this, true);
             } else {
                 ((NodeImpl)coreGetLastKnownChild()).internalSetNextSibling(newDomChild);
                 newDomChild.internalSetPreviousSibling((NodeImpl)coreGetLastKnownChild());
@@ -153,7 +139,7 @@ public abstract class ParentNode extends
                 ((NodeImpl)coreGetLastKnownChild()).internalSetNextSibling(null);
             }
             if (newDomChild.parentNode() == null) {
-                newDomChild.setParent(this, useDomSemantics);
+                newDomChild.setParent(this, true);
             }
         } else {
             NodeImpl tempNode = (NodeImpl)getFirstChild();
@@ -171,7 +157,7 @@ public abstract class ParentNode extends
                             
                             NodeImpl child = (NodeImpl)docFrag.coreGetFirstChildIfAvailable();
                             while (child != null) {
-                                child.setParent(this, useDomSemantics);
+                                child.setParent(this, true);
                                 child = child.internalGetNextSibling();
                             }
                             
@@ -203,7 +189,7 @@ public abstract class ParentNode extends
 
                             NodeImpl child = (NodeImpl)docFrag.coreGetFirstChildIfAvailable();
                             while (child != null) {
-                                child.setParent(this, useDomSemantics);
+                                child.setParent(this, true);
                                 child = child.internalGetNextSibling();
                             }
                             
@@ -236,7 +222,7 @@ public abstract class ParentNode extends
             }
 
             if (!(newDomChild instanceof DocumentFragmentImpl) && newDomChild.parentNode()
== null) {
-                newDomChild.setParent(this, useDomSemantics);
+                newDomChild.setParent(this, true);
             }
 
         }



Mime
View raw message