You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/05/28 12:12:29 UTC

svn commit: r1343188 - /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/

Author: veithen
Date: Mon May 28 10:12:29 2012
New Revision: 1343188

URL: http://svn.apache.org/viewvc?rev=1343188&view=rev
Log:
Ensure that only real child nodes have previousSibling/nextSibling attributes.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/RootNode.java   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java Mon May 28 10:12:29 2012
@@ -355,7 +355,7 @@ public class AttrImpl extends NodeImpl i
         if (clone.attrValue == null) {
             // Need to break the association w/ original kids
             clone.attrValue = new TextImpl(this.attrValue.toString(), factory);
-            if (this.attrValue.nextSibling != null) {
+            if (this.attrValue.internalGetNextSibling() != null) {
                 throw new UnsupportedOperationException(
                         "Attribute value can contain only a text " +
                                 "node with out any siblings");

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java Mon May 28 10:12:29 2012
@@ -28,7 +28,7 @@ import org.w3c.dom.DOMException;
  * This implements the OMText operations which are to be inherited by TextImpl, CommentImpl,
  * CDATASectionImpl.
  */
-public abstract class CharacterImpl extends ChildNode implements CharacterData, OMNodeEx {
+public abstract class CharacterImpl extends LeafNode implements CharacterData, OMNodeEx {
 
     protected String textValue;
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java Mon May 28 10:12:29 2012
@@ -41,10 +41,6 @@ import org.w3c.dom.Node;
 
 public abstract class ChildNode extends NodeImpl {
 
-    protected ChildNode previousSibling;
-
-    protected ChildNode nextSibling;
-
     /**
      * The parent or the owner document of the node. The meaning of this attribute depends on the
      * {@link NodeImpl#HAS_PARENT} flag.
@@ -61,6 +57,14 @@ public abstract class ChildNode extends 
         super(factory);
     }
 
+    abstract ChildNode internalGetPreviousSibling();
+    
+    abstract ChildNode internalGetNextSibling();
+    
+    abstract void internalSetPreviousSibling(ChildNode previousSibling);
+    
+    abstract void internalSetNextSibling(ChildNode nextSibling);
+    
     /**
      * Get the owner document of this node. In contrast to {@link Node#getOwnerDocument()}, this
      * method returns a non null value when invoked on a {@link Document} instance.
@@ -116,14 +120,14 @@ public abstract class ChildNode extends 
 
     public OMNode getNextOMSibling() throws OMException {
         ParentNode parentNode = parentNode();
-        while (nextSibling == null && parentNode != null && !parentNode.done && parentNode.builder != null) {
+        while (internalGetNextSibling() == null && parentNode != null && !parentNode.done && parentNode.builder != null) {
             parentNode.buildNext();
         }
-        return (OMNode)nextSibling;
+        return (OMNode)internalGetNextSibling();
     }
 
     public OMNode getNextOMSiblingIfAvailable() {
-        return (OMNode)nextSibling;
+        return (OMNode)internalGetNextSibling();
     }
 
     public Node getNextSibling() {
@@ -131,11 +135,11 @@ public abstract class ChildNode extends 
     }
 
     public OMNode getPreviousOMSibling() {
-        return (OMNode)this.previousSibling;
+        return (OMNode)internalGetPreviousSibling();
     }
 
     public Node getPreviousSibling() {
-        return this.previousSibling;
+        return internalGetPreviousSibling();
     }
 
     // /
@@ -143,11 +147,11 @@ public abstract class ChildNode extends 
     // /
     public void setNextOMSibling(OMNode node) {
         if (node == null) {
-            this.nextSibling = null;
+            internalSetNextSibling(null);
             return;
         }
         if (node instanceof ChildNode) {
-            this.nextSibling = (ChildNode) node;
+            internalSetNextSibling((ChildNode)node);
         } else {
             throw new OMException("The node is not a " + ChildNode.class);
         }
@@ -155,11 +159,11 @@ public abstract class ChildNode extends 
 
     public void setPreviousOMSibling(OMNode node) {
         if (node == null) {
-            this.previousSibling = null;
+            internalSetPreviousSibling(null);
             return;
         }
         if (node instanceof ChildNode) {
-            this.previousSibling = (ChildNode) node;
+            internalSetPreviousSibling((ChildNode)node);
         } else {
             throw new OMException("The node is not a " + ChildNode.class);
         }
@@ -204,6 +208,8 @@ public abstract class ChildNode extends 
                 build();
             }
             getNextOMSibling(); // Make sure that nextSibling is set correctly
+            ChildNode previousSibling = internalGetPreviousSibling();
+            ChildNode nextSibling = internalGetNextSibling();
             if (previousSibling == null) { // This is the first child
                 if (nextSibling != null) {
                     parentNode.setFirstChild((OMNode)nextSibling);
@@ -212,20 +218,20 @@ public abstract class ChildNode extends 
                     parentNode.lastChild = null;
                 }
             } else {
-                this.previousSibling.setNextOMSibling((OMNode)nextSibling);
+                previousSibling.setNextOMSibling((OMNode)nextSibling);
                 if (nextSibling == null) {
-                    this.previousSibling.parentNode().done = true;
+                    previousSibling.parentNode().done = true;
                 }
             }
-            if (this.nextSibling != null) {
-                this.nextSibling.setPreviousOMSibling((OMNode)this.previousSibling);
-                this.nextSibling = null;
+            if (nextSibling != null) {
+                nextSibling.setPreviousOMSibling((OMNode)previousSibling);
+                internalSetNextSibling(null);
             }
             if (parentNode != null && parentNode.lastChild == this) {
                 parentNode.lastChild = previousSibling;
             }
             setParent(null, useDomSemantics);
-            this.previousSibling = null;
+            internalSetPreviousSibling(null);
         }
         return (OMNode)this;
     }
@@ -245,14 +251,15 @@ public abstract class ChildNode extends 
         ((OMNodeEx) sibling).setParent(parentNode);
         if (sibling instanceof ChildNode) {
             ChildNode domSibling = (ChildNode) sibling;
-            domSibling.previousSibling = this;
-            if (this.nextSibling == null) {
+            domSibling.internalSetPreviousSibling(this);
+            ChildNode nextSibling = internalGetNextSibling();
+            if (nextSibling == null) {
                 parentNode.setLastChild(sibling);
             } else {
-                this.nextSibling.previousSibling = domSibling;
+                nextSibling.internalSetPreviousSibling(domSibling);
             }
-            domSibling.nextSibling = this.nextSibling;
-            this.nextSibling = domSibling;
+            domSibling.internalSetNextSibling(nextSibling);
+            internalSetNextSibling(domSibling);
 
         } else {
             throw new OMException("The given child is not of type "
@@ -278,16 +285,17 @@ public abstract class ChildNode extends 
             // domSibling.previousSibling = this.previousSibling;
             // this.previousSibling = domSibling;
             ChildNode siblingImpl = (ChildNode) sibling;
-            siblingImpl.nextSibling = this;
+            siblingImpl.internalSetNextSibling(this);
+            ChildNode previousSibling = internalGetPreviousSibling();
             if (previousSibling == null) {
                 parentNode.setFirstChild((OMNode)siblingImpl);
-                siblingImpl.previousSibling = null;
+                siblingImpl.internalSetPreviousSibling(null);
             } else {
                 siblingImpl.setParent(parentNode, false);
                 previousSibling.setNextOMSibling((OMNode)siblingImpl);
                 siblingImpl.setPreviousOMSibling((OMNode)previousSibling);
             }
-            previousSibling = siblingImpl;
+            internalSetPreviousSibling(siblingImpl);
 
         } else {
             throw new OMException("The given child is not of type "
@@ -301,8 +309,8 @@ public abstract class ChildNode extends 
         ChildNode newnode = (ChildNode) super.cloneNode(deep);
 
         // Need to break the association w/ original kids
-        newnode.previousSibling = null;
-        newnode.nextSibling = null;
+        newnode.internalSetPreviousSibling(null);
+        newnode.internalSetNextSibling(null);
         newnode.isFirstChild(false);
         newnode.ownerNode = ownerDocument();
         newnode.hasParent(false);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentImpl.java Mon May 28 10:12:29 2012
@@ -30,7 +30,7 @@ import org.w3c.dom.Node;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-public class DocumentFragmentImpl extends ParentNode implements
+public class DocumentFragmentImpl extends RootNode implements
         DocumentFragment {
 
     /** @param ownerDocument  */

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java Mon May 28 10:12:29 2012
@@ -60,7 +60,7 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Vector;
 
-public class DocumentImpl extends ParentNode implements Document, OMDocument {
+public class DocumentImpl extends RootNode implements Document, OMDocument {
 
     private String xmlVersion;
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentTypeImpl.java Mon May 28 10:12:29 2012
@@ -32,7 +32,7 @@ import org.apache.axiom.om.impl.OMNodeEx
 import org.w3c.dom.DocumentType;
 import org.w3c.dom.NamedNodeMap;
 
-public class DocumentTypeImpl extends ChildNode implements DocumentType, OMDocType, OMNodeEx {
+public class DocumentTypeImpl extends LeafNode implements DocumentType, OMDocType, OMNodeEx {
     private String value;
     
     public DocumentTypeImpl(DocumentImpl ownerDocument, OMFactory factory) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java Mon May 28 10:12:29 2012
@@ -68,6 +68,10 @@ public class ElementImpl extends ParentN
 
     private static final Log log = LogFactory.getLog(ElementImpl.class);
     
+    private ChildNode previousSibling;
+
+    private ChildNode nextSibling;
+
     private int lineNumber;
 
     /**
@@ -171,6 +175,22 @@ public class ElementImpl extends ParentN
         super(factory);
     }
 
+    final ChildNode internalGetPreviousSibling() {
+        return previousSibling;
+    }
+    
+    final ChildNode internalGetNextSibling() {
+        return nextSibling;
+    }
+    
+    final void internalSetPreviousSibling(ChildNode previousSibling) {
+        this.previousSibling = previousSibling;
+    }
+    
+    final void internalSetNextSibling(ChildNode nextSibling) {
+        this.nextSibling = nextSibling;
+    }
+
     private OMNamespace handleNamespace(OMNamespace ns) {
         String namespaceURI = ns == null ? "" : ns.getNamespaceURI();
         String prefix = ns == null ? "" : ns.getPrefix();

Added: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java?rev=1343188&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java Mon May 28 10:12:29 2012
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMFactory;
+
+public abstract class LeafNode extends ChildNode {
+    private ChildNode previousSibling;
+
+    private ChildNode nextSibling;
+
+    protected LeafNode(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    public LeafNode(OMFactory factory) {
+        super(factory);
+    }
+
+    final ChildNode internalGetPreviousSibling() {
+        return previousSibling;
+    }
+    
+    final ChildNode internalGetNextSibling() {
+        return nextSibling;
+    }
+    
+    final void internalSetPreviousSibling(ChildNode previousSibling) {
+        this.previousSibling = previousSibling;
+    }
+    
+    final void internalSetNextSibling(ChildNode nextSibling) {
+        this.nextSibling = nextSibling;
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/LeafNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java Mon May 28 10:12:29 2012
@@ -256,10 +256,10 @@ public abstract class ParentNode extends
                 this.firstChild.isFirstChild(true);
                 newDomChild.setParent(this, useDomSemantics);
             } else {
-                this.lastChild.nextSibling = newDomChild;
-                newDomChild.previousSibling = this.lastChild;
+                this.lastChild.internalSetNextSibling(newDomChild);
+                newDomChild.internalSetPreviousSibling(this.lastChild);
                 this.lastChild = newDomChild;
-                this.lastChild.nextSibling = null;
+                this.lastChild.internalSetNextSibling(null);
             }
             if (newDomChild.parentNode() == null) {
                 newDomChild.setParent(this, useDomSemantics);
@@ -283,13 +283,12 @@ public abstract class ParentNode extends
                             ChildNode child = docFrag.firstChild;
                             while (child != null) {
                                 child.setParent(this, useDomSemantics);
-                                child = child.nextSibling;
+                                child = child.internalGetNextSibling();
                             }
                             
                             this.firstChild = docFrag.firstChild;
-                            docFrag.lastChild.nextSibling = refDomChild;
-                            refDomChild.previousSibling =
-                                    docFrag.lastChild.nextSibling;
+                            docFrag.lastChild.internalSetNextSibling(refDomChild);
+                            refDomChild.internalSetPreviousSibling(docFrag.lastChild.internalGetNextSibling());
 
                             docFrag.firstChild = null;
                             docFrag.lastChild = null;
@@ -298,17 +297,17 @@ public abstract class ParentNode extends
                             // Make the newNode the first Child
                             this.firstChild = newDomChild;
 
-                            newDomChild.nextSibling = refDomChild;
-                            refDomChild.previousSibling = newDomChild;
+                            newDomChild.internalSetNextSibling(refDomChild);
+                            refDomChild.internalSetPreviousSibling(newDomChild);
 
                             this.firstChild.isFirstChild(true);
                             refDomChild.isFirstChild(false);
-                            newDomChild.previousSibling = null; // Just to be
+                            newDomChild.internalSetPreviousSibling(null); // Just to be
                             // sure :-)
 
                         }
                     } else { // If the refChild is not the fist child
-                        ChildNode previousNode = refDomChild.previousSibling;
+                        ChildNode previousNode = refDomChild.internalGetPreviousSibling();
 
                         if (newChild instanceof DocumentFragmentImpl) {
                             // the newChild is a document fragment
@@ -318,24 +317,24 @@ public abstract class ParentNode extends
                             ChildNode child = docFrag.firstChild;
                             while (child != null) {
                                 child.setParent(this, useDomSemantics);
-                                child = child.nextSibling;
+                                child = child.internalGetNextSibling();
                             }
                             
-                            previousNode.nextSibling = docFrag.firstChild;
-                            docFrag.firstChild.previousSibling = previousNode;
+                            previousNode.internalSetNextSibling(docFrag.firstChild);
+                            docFrag.firstChild.internalSetPreviousSibling(previousNode);
 
-                            docFrag.lastChild.nextSibling = refDomChild;
-                            refDomChild.previousSibling = docFrag.lastChild;
+                            docFrag.lastChild.internalSetNextSibling(refDomChild);
+                            refDomChild.internalSetPreviousSibling(docFrag.lastChild);
 
                             docFrag.firstChild = null;
                             docFrag.lastChild = null;
                         } else {
 
-                            previousNode.nextSibling = newDomChild;
-                            newDomChild.previousSibling = previousNode;
+                            previousNode.internalSetNextSibling(newDomChild);
+                            newDomChild.internalSetPreviousSibling(previousNode);
 
-                            newDomChild.nextSibling = refDomChild;
-                            refDomChild.previousSibling = newDomChild;
+                            newDomChild.internalSetNextSibling(refDomChild);
+                            refDomChild.internalSetPreviousSibling(newDomChild);
                         }
 
                     }
@@ -396,7 +395,7 @@ public abstract class ParentNode extends
                     //set the parent of all kids to me
                     while(child != null) {
                         child.setParent(this, true);
-                        child = child.nextSibling;
+                        child = child.internalGetNextSibling();
                     }
 
                     this.lastChild = (ChildNode)docFrag.getLastChild();
@@ -404,28 +403,28 @@ public abstract class ParentNode extends
                 } else {
                     if (this.firstChild == oldDomChild) {
 
-                        if (this.firstChild.nextSibling != null) {
-                            this.firstChild.nextSibling.previousSibling = newDomChild;
-                            newDomChild.nextSibling = this.firstChild.nextSibling;
+                        if (this.firstChild.internalGetNextSibling() != null) {
+                            this.firstChild.internalGetNextSibling().internalSetPreviousSibling(newDomChild);
+                            newDomChild.internalSetNextSibling(this.firstChild.internalGetNextSibling());
                         }
 
                         //Cleanup the current first child
                         this.firstChild.setParent(null, true);
-                        this.firstChild.nextSibling = null;
+                        this.firstChild.internalSetNextSibling(null);
 
                         //Set the new first child
                         this.firstChild = newDomChild;
                         
 
                     } else {
-                        newDomChild.nextSibling = oldDomChild.nextSibling;
-                        newDomChild.previousSibling = oldDomChild.previousSibling;
+                        newDomChild.internalSetNextSibling(oldDomChild.internalGetNextSibling());
+                        newDomChild.internalSetPreviousSibling(oldDomChild.internalGetPreviousSibling());
 
-                        oldDomChild.previousSibling.nextSibling = newDomChild;
+                        oldDomChild.internalGetPreviousSibling().internalSetNextSibling(newDomChild);
 
                         // If the old child is not the last
-                        if (oldDomChild.nextSibling != null) {
-                            oldDomChild.nextSibling.previousSibling = newDomChild;
+                        if (oldDomChild.internalGetNextSibling() != null) {
+                            oldDomChild.internalGetNextSibling().internalSetPreviousSibling(newDomChild);
                         } else {
                             this.lastChild = newDomChild;
                         }
@@ -437,8 +436,8 @@ public abstract class ParentNode extends
                 found = true;
 
                 // remove the old child's references to this tree
-                oldDomChild.nextSibling = null;
-                oldDomChild.previousSibling = null;
+                oldDomChild.internalSetNextSibling(null);
+                oldDomChild.internalSetPreviousSibling(null);
                 oldDomChild.setParent(null, true);
             }
         }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java?rev=1343188&r1=1343187&r2=1343188&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java Mon May 28 10:12:29 2012
@@ -33,7 +33,7 @@ import org.w3c.dom.DOMException;
 import org.w3c.dom.Node;
 import org.w3c.dom.ProcessingInstruction;
 
-public class ProcessingInstructionImpl extends ChildNode implements ProcessingInstruction, OMProcessingInstruction, OMNodeEx {
+public class ProcessingInstructionImpl extends LeafNode implements ProcessingInstruction, OMProcessingInstruction, OMNodeEx {
     private String target;
     private String value;
 

Added: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/RootNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/RootNode.java?rev=1343188&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/RootNode.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/RootNode.java Mon May 28 10:12:29 2012
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMFactory;
+
+public abstract class RootNode extends ParentNode {
+    protected RootNode(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    public RootNode(OMFactory factory) {
+        super(factory);
+    }
+
+    final ChildNode internalGetPreviousSibling() {
+        return null;
+    }
+
+    final ChildNode internalGetNextSibling() {
+        return null;
+    }
+
+    final void internalSetPreviousSibling(ChildNode previousSibling) {
+        throw new UnsupportedOperationException();
+    }
+
+    final void internalSetNextSibling(ChildNode nextSibling) {
+        throw new UnsupportedOperationException();
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/RootNode.java
------------------------------------------------------------------------------
    svn:eol-style = native