ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1697213 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/ implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/fac...
Date Sun, 23 Aug 2015 16:19:22 GMT
Author: veithen
Date: Sun Aug 23 16:19:21 2015
New Revision: 1697213

URL: http://svn.apache.org/r1697213
Log:
Add support for namespace unaware DOM elements.

Added:
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSAwareElement.java
      - copied, changed from r1697144, webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSUnawareElement.java
  (with props)
Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSUnawareElementSupport.aj
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
    webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElement.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSUnawareElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSUnawareElementSupport.aj?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSUnawareElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreNSUnawareElementSupport.aj
Sun Aug 23 16:19:21 2015
@@ -22,4 +22,12 @@ public aspect CoreNSUnawareElementSuppor
     public final int CoreNSUnawareElement.coreGetNodeType() {
         return NS_UNAWARE_ELEMENT_NODE;
     }
+    
+    public final String CoreNSUnawareElement.getImplicitNamespaceURI(String prefix) {
+        return null;
+    }
+
+    public final String CoreNSUnawareElement.getImplicitPrefix(String namespaceURI) {
+        return null;
+    }
 }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Sun Aug 23 16:19:21 2015
@@ -73,7 +73,8 @@ public class DocumentImpl extends Parent
     }
 
     public Element createElement(String tagName) throws DOMException {
-        ElementImpl element = new ElementImpl(null, tagName, null, null, getOMFactory(),
false);
+        NSUnawareElement element = new NSUnawareElement(getOMFactory());
+        element.coreSetName(tagName);
         element.coreSetOwnerDocument(this);
         return element;
     }
@@ -95,7 +96,7 @@ public class DocumentImpl extends Parent
         } else {
             namespace = new OMNamespaceImpl(namespaceURI, prefix == null ? "" : prefix);
         }
-        ElementImpl element = new ElementImpl(null, localName, namespace, null, getOMFactory(),
false);
+        NSAwareElement element = new NSAwareElement(null, localName, namespace, null, getOMFactory(),
false);
         element.coreSetOwnerDocument(this);
         return element;
     }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
Sun Aug 23 16:19:21 2015
@@ -24,50 +24,20 @@ import static org.apache.axiom.dom.DOMEx
 import org.apache.axiom.core.NodeMigrationException;
 import org.apache.axiom.core.NodeMigrationPolicy;
 import org.apache.axiom.dom.DOMAttribute;
-import org.apache.axiom.dom.DOMConfigurationImpl;
+import org.apache.axiom.dom.DOMElement;
 import org.apache.axiom.dom.DOMExceptionTranslator;
-import org.apache.axiom.dom.DOMNSAwareElement;
 import org.apache.axiom.dom.Policies;
 import org.apache.axiom.om.OMCloneOptions;
-import org.apache.axiom.om.OMConstants;
-import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.common.AxiomContainer;
-import org.apache.axiom.om.impl.common.AxiomElement;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.NamedNodeMap;
 
-import java.util.Iterator;
-
-/** Implementation of the org.w3c.dom.Element and org.apache.axiom.om.Element interfaces.
*/
-public class ElementImpl extends ParentNode implements DOMNSAwareElement, AxiomElement,
-        OMConstants {
-
-    private int lineNumber;
-
+public abstract class ElementImpl extends ParentNode implements DOMElement {
     public ElementImpl(OMFactory factory) {
         super(factory);
     }
-    
-    public ElementImpl(ParentNode parentNode, String localName, OMNamespace ns, OMXMLParserWrapper
builder,
-                       OMFactory factory, boolean generateNSDecl) {
-        super(factory);
-        coreSetBuilder(builder);
-        if (parentNode != null) {
-            // TODO: dirty hack to get the correct semantics (reordering) if the parent is
a SOAP envelope
-            if (parentNode instanceof AxiomContainer) {
-                ((AxiomContainer)parentNode).addChild(this, builder != null);
-            } else {
-                parentNode.coreAppendChild(this, builder != null);
-            }
-        }
-        initName(localName, ns, generateNSDecl);
-    }
 
     private final String checkNamespaceIsDeclared(String prefix, String namespaceURI, boolean
allowDefaultNamespace, boolean declare) {
         if (prefix == null) {
@@ -92,25 +62,8 @@ public class ElementImpl extends ParentN
         return prefix;
     }
 
-    // /
-    // /OmElement methods
-    // /
-
-    public void setNamespace(OMNamespace namespace) {
-        setNamespace(namespace, true);
-    }
-
-    public OMElement cloneOMElement() {
-        return (OMElement)clone(new OMCloneOptions());
-    }
-
     final ParentNode shallowClone(OMCloneOptions options, ParentNode targetParent, boolean
namespaceRepairing) {
-        ElementImpl clone;
-        if (options.isPreserveModel()) {
-            clone = (ElementImpl)createClone(options, targetParent, namespaceRepairing);
-        } else {
-            clone = new ElementImpl(targetParent, getLocalName(), getNamespace(), null, getOMFactory(),
namespaceRepairing);
-        }
+        ElementImpl clone = createClone0(options, targetParent, namespaceRepairing);
         NamedNodeMap attributes = getAttributes();
         for (int i=0, l=attributes.getLength(); i<l; i++) {
             AttrImpl attr = (AttrImpl)attributes.item(i);
@@ -132,35 +85,13 @@ public class ElementImpl extends ParentN
         return clone;
     }
 
-    protected OMElement createClone(OMCloneOptions options, ParentNode targetParent, boolean
generateNSDecl) {
-        return new ElementImpl(targetParent, getLocalName(), getNamespace(), null, getOMFactory(),
generateNSDecl);
-    }
+    abstract ElementImpl createClone0(OMCloneOptions options, ParentNode targetParent, boolean
namespaceRepairing);
     
-    public void setLineNumber(int lineNumber) {
-        this.lineNumber = lineNumber;
-    }
-
-    public int getLineNumber() {
-        return lineNumber;
-    }
-
-    /**
-     * Returns the namespace uri, given the prefix. If it is not found at this element, searches
the
-     * parent.
-     *
-     * @param prefix
-     * @return Returns namespace.
-     */
-    public String getNamespaceURI(String prefix) {
-        OMNamespace ns = this.findNamespaceURI(prefix);
-        return (ns != null) ? ns.getNamespaceURI() : null;
-    }
-
     /*
      * DOM-Level 3 methods
      */
 
-    public void setIdAttribute(String name, boolean isId) throws DOMException {
+    public final void setIdAttribute(String name, boolean isId) throws DOMException {
         //find the attr
         AttrImpl tempAttr = (AttrImpl) this.getAttributeNode(name);
         if (tempAttr == null) {
@@ -170,7 +101,7 @@ public class ElementImpl extends ParentN
         this.updateIsId(isId, tempAttr);
     }
 
-    public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
+    public final void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
             throws DOMException {
         //find the attr
         AttrImpl tempAttr = (AttrImpl) this.getAttributeNodeNS(namespaceURI, localName);
@@ -181,7 +112,7 @@ public class ElementImpl extends ParentN
         this.updateIsId(isId, tempAttr);
     }
 
-    public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
+    public final void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
         //find the attr
         if (((DOMAttribute)idAttr).coreGetOwnerElement() != this) {
             throw newDOMException(DOMException.NOT_FOUND_ERR);
@@ -205,42 +136,4 @@ public class ElementImpl extends ParentN
             }
         }
     }
-
-    /* (non-Javadoc)
-      * @see org.apache.axiom.om.OMNode#buildAll()
-      */
-    public void buildWithAttachments() {
-        if (getState() == INCOMPLETE) {
-            this.build();
-        }
-        Iterator iterator = getChildren();
-        while (iterator.hasNext()) {
-            OMNode node = (OMNode) iterator.next();
-            node.buildWithAttachments();
-        }
-    }
-
-    public void normalize(DOMConfigurationImpl config) {
-        if (config.isEnabled(DOMConfigurationImpl.NAMESPACES)) {
-            OMNamespace namespace = getNamespace();
-            if (namespace == null) {
-                if (getDefaultNamespace() != null) {
-                    declareDefaultNamespace("");
-                }
-            } else {
-                OMNamespace namespaceForPrefix = findNamespaceURI(namespace.getPrefix());
-                if (namespaceForPrefix == null || !namespaceForPrefix.getNamespaceURI().equals(namespace.getNamespaceURI()))
{
-                    declareNamespace(namespace);
-                }
-            }
-        }
-        super.normalize(config);
-    }
-
-    public final void build() {
-        defaultBuild();
-    }
-
-    public final void checkChild(OMNode child) {
-    }
 }

Copied: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSAwareElement.java
(from r1697144, webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSAwareElement.java?p2=webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSAwareElement.java&p1=webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java&r1=1697144&r2=1697213&rev=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSAwareElement.java
Sun Aug 23 16:19:21 2015
@@ -19,15 +19,10 @@
 
 package org.apache.axiom.om.impl.dom;
 
-import static org.apache.axiom.dom.DOMExceptionUtil.newDOMException;
+import java.util.Iterator;
 
-import org.apache.axiom.core.NodeMigrationException;
-import org.apache.axiom.core.NodeMigrationPolicy;
-import org.apache.axiom.dom.DOMAttribute;
 import org.apache.axiom.dom.DOMConfigurationImpl;
-import org.apache.axiom.dom.DOMExceptionUtil;
 import org.apache.axiom.dom.DOMNSAwareElement;
-import org.apache.axiom.dom.Policies;
 import org.apache.axiom.om.OMCloneOptions;
 import org.apache.axiom.om.OMConstants;
 import org.apache.axiom.om.OMElement;
@@ -37,24 +32,18 @@ import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.common.AxiomContainer;
 import org.apache.axiom.om.impl.common.AxiomElement;
-import org.apache.axiom.om.impl.util.OMSerializerUtil;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-
-import java.util.Iterator;
 
 /** Implementation of the org.w3c.dom.Element and org.apache.axiom.om.Element interfaces.
*/
-public class ElementImpl extends ParentNode implements DOMNSAwareElement, AxiomElement,
+public class NSAwareElement extends ElementImpl implements DOMNSAwareElement, AxiomElement,
         OMConstants {
 
     private int lineNumber;
 
-    public ElementImpl(OMFactory factory) {
+    public NSAwareElement(OMFactory factory) {
         super(factory);
     }
     
-    public ElementImpl(ParentNode parentNode, String localName, OMNamespace ns, OMXMLParserWrapper
builder,
+    public NSAwareElement(ParentNode parentNode, String localName, OMNamespace ns, OMXMLParserWrapper
builder,
                        OMFactory factory, boolean generateNSDecl) {
         super(factory);
         coreSetBuilder(builder);
@@ -69,29 +58,6 @@ public class ElementImpl extends ParentN
         initName(localName, ns, generateNSDecl);
     }
 
-    private final String checkNamespaceIsDeclared(String prefix, String namespaceURI, boolean
allowDefaultNamespace, boolean declare) {
-        if (prefix == null) {
-            if (namespaceURI.length() == 0) {
-                prefix = "";
-                declare = false;
-            } else {
-                prefix = coreLookupPrefix(namespaceURI, true);
-                if (prefix != null && (allowDefaultNamespace || prefix.length() !=
0)) {
-                    declare = false;
-                } else {
-                    prefix = OMSerializerUtil.getNextNSPrefix();
-                }
-            }
-        } else {
-            String existingNamespaceURI = coreLookupNamespaceURI(prefix, true);
-            declare = declare && !namespaceURI.equals(existingNamespaceURI);
-        }
-        if (declare) {
-            coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, null, prefix, null,
namespaceURI);
-        }
-        return prefix;
-    }
-
     // /
     // /OmElement methods
     // /
@@ -104,36 +70,17 @@ public class ElementImpl extends ParentN
         return (OMElement)clone(new OMCloneOptions());
     }
 
-    final ParentNode shallowClone(OMCloneOptions options, ParentNode targetParent, boolean
namespaceRepairing) {
-        ElementImpl clone;
+    @Override
+    final ElementImpl createClone0(OMCloneOptions options, ParentNode targetParent, boolean
namespaceRepairing) {
         if (options.isPreserveModel()) {
-            clone = (ElementImpl)createClone(options, targetParent, namespaceRepairing);
+            return (ElementImpl)createClone(options, targetParent, namespaceRepairing);
         } else {
-            clone = new ElementImpl(targetParent, getLocalName(), getNamespace(), null, getOMFactory(),
namespaceRepairing);
-        }
-        NamedNodeMap attributes = getAttributes();
-        for (int i=0, l=attributes.getLength(); i<l; i++) {
-            AttrImpl attr = (AttrImpl)attributes.item(i);
-            AttrImpl clonedAttr = (AttrImpl)attr.clone(options, null, true, false);
-            clonedAttr.coreSetSpecified(attr.coreGetSpecified());
-            if (namespaceRepairing && attr instanceof NSAwareAttribute) {
-                NSAwareAttribute nsAwareAttr = (NSAwareAttribute)attr;
-                String namespaceURI = nsAwareAttr.coreGetNamespaceURI();
-                if (namespaceURI.length() != 0) {
-                    clone.checkNamespaceIsDeclared(nsAwareAttr.coreGetPrefix(), namespaceURI,
false, true);
-                }
-            }
-            try {
-                clone.coreAppendAttribute(clonedAttr, NodeMigrationPolicy.MOVE_ALWAYS);
-            } catch (NodeMigrationException ex) {
-                DOMExceptionUtil.translate(ex);
-            }
+            return new NSAwareElement(targetParent, getLocalName(), getNamespace(), null,
getOMFactory(), namespaceRepairing);
         }
-        return clone;
     }
 
     protected OMElement createClone(OMCloneOptions options, ParentNode targetParent, boolean
generateNSDecl) {
-        return new ElementImpl(targetParent, getLocalName(), getNamespace(), null, getOMFactory(),
generateNSDecl);
+        return new NSAwareElement(targetParent, getLocalName(), getNamespace(), null, getOMFactory(),
generateNSDecl);
     }
     
     public void setLineNumber(int lineNumber) {
@@ -156,56 +103,6 @@ public class ElementImpl extends ParentN
         return (ns != null) ? ns.getNamespaceURI() : null;
     }
 
-    /*
-     * DOM-Level 3 methods
-     */
-
-    public void setIdAttribute(String name, boolean isId) throws DOMException {
-        //find the attr
-        AttrImpl tempAttr = (AttrImpl) this.getAttributeNode(name);
-        if (tempAttr == null) {
-            throw newDOMException(DOMException.NOT_FOUND_ERR);
-        }
-
-        this.updateIsId(isId, tempAttr);
-    }
-
-    public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
-            throws DOMException {
-        //find the attr
-        AttrImpl tempAttr = (AttrImpl) this.getAttributeNodeNS(namespaceURI, localName);
-        if (tempAttr == null) {
-            throw newDOMException(DOMException.NOT_FOUND_ERR);
-        }
-
-        this.updateIsId(isId, tempAttr);
-    }
-
-    public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
-        //find the attr
-        if (((DOMAttribute)idAttr).coreGetOwnerElement() != this) {
-            throw newDOMException(DOMException.NOT_FOUND_ERR);
-        }
-        this.updateIsId(isId, (AttrImpl)idAttr);
-    }
-
-    /**
-     * Updates the id state of the attr and notifies the document
-     *
-     * @param isId
-     * @param tempAttr
-     */
-    private void updateIsId(boolean isId, AttrImpl tempAttr) {
-        if (tempAttr.isId != isId) {
-            tempAttr.isId = isId;
-            if (isId) {
-                ownerDocument().addIdAttr(tempAttr);
-            } else {
-                ownerDocument().removeIdAttr(tempAttr);
-            }
-        }
-    }
-
     /* (non-Javadoc)
       * @see org.apache.axiom.om.OMNode#buildAll()
       */

Added: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSUnawareElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSUnawareElement.java?rev=1697213&view=auto
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSUnawareElement.java
(added)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NSUnawareElement.java
Sun Aug 23 16:19:21 2015
@@ -0,0 +1,44 @@
+/*
+ * 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.core.NodeFactory;
+import org.apache.axiom.dom.DOMNSUnawareElement;
+import org.apache.axiom.om.OMCloneOptions;
+import org.apache.axiom.om.OMFactory;
+
+public class NSUnawareElement extends ElementImpl implements DOMNSUnawareElement {
+    public NSUnawareElement(OMFactory factory) {
+        super(factory);
+    }
+
+    public final NodeFactory coreGetNodeFactory() {
+        return ((NodeFactory)getOMFactory());
+    }
+
+    public void build() {
+        // Do nothing: the builder never creates NS unaware elements
+    }
+
+    @Override
+    ElementImpl createClone0(OMCloneOptions options, ParentNode targetParent, boolean namespaceRepairing)
{
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+}

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

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=1697213&r1=1697212&r2=1697213&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
Sun Aug 23 16:19:21 2015
@@ -64,7 +64,7 @@ public abstract class ParentNode extends
 
         if (this instanceof Document) {
             if (newDomChild instanceof ElementImpl) {
-                if (!(replacedChild instanceof Element) && ((DocumentImpl) this).getOMDocumentElement()
!= null) {
+                if (!(replacedChild instanceof Element) && ((DocumentImpl) this).coreGetDocumentElement()
!= null) {
                     // Throw exception since there cannot be two document elements
                     throw newDOMException(DOMException.HIERARCHY_REQUEST_ERR);
                 }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
Sun Aug 23 16:19:21 2015
@@ -56,7 +56,7 @@ public abstract class TextNodeImpl exten
 
         ParentNode parentNode = (ParentNode)coreGetParent();
         if (parentNode != null) {
-            this.insertSiblingAfter(newText);
+            coreInsertSiblingAfter(newText);
         }
 
         return newText;

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
Sun Aug 23 16:19:21 2015
@@ -57,9 +57,9 @@ import org.apache.axiom.om.impl.dom.CDAT
 import org.apache.axiom.om.impl.dom.CommentImpl;
 import org.apache.axiom.om.impl.dom.DocumentImpl;
 import org.apache.axiom.om.impl.dom.DocumentTypeImpl;
-import org.apache.axiom.om.impl.dom.ElementImpl;
 import org.apache.axiom.om.impl.dom.EntityReferenceImpl;
 import org.apache.axiom.om.impl.dom.NSAwareAttribute;
+import org.apache.axiom.om.impl.dom.NSAwareElement;
 import org.apache.axiom.om.impl.dom.NSUnawareAttribute;
 import org.apache.axiom.om.impl.dom.NamespaceDeclaration;
 import org.apache.axiom.om.impl.dom.ProcessingInstructionImpl;
@@ -335,7 +335,7 @@ public class OMDOMFactory implements Axi
     public final <T extends CoreNSAwareElement> T createNSAwareElement(Class<T>
type) {
         CoreNSAwareElement element;
         if (type == AxiomElement.class) {
-            element = new ElementImpl(this);
+            element = new NSAwareElement(this);
         } else if (type == AxiomSOAPEnvelope.class) {
             element = new SOAPEnvelopeImpl(this);
         } else if (type == AxiomSOAP11Header.class) {

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
Sun Aug 23 16:19:21 2015
@@ -23,13 +23,13 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.NSAwareElement;
 import org.apache.axiom.om.impl.dom.ParentNode;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.common.AxiomSOAPElement;
 
-public abstract class SOAPElement extends ElementImpl implements AxiomSOAPElement {
+public abstract class SOAPElement extends NSAwareElement implements AxiomSOAPElement {
     public SOAPElement(OMFactory factory) {
         super(factory);
     }

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
Sun Aug 23 16:19:21 2015
@@ -25,7 +25,7 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.NSAwareElement;
 import org.apache.axiom.om.impl.dom.ParentNode;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPConstants;
@@ -101,7 +101,7 @@ public abstract class SOAPFaultImpl exte
             detail = getNewSOAPFaultDetail(this);
             setDetail(detail);
         }
-        OMElement faultDetailEnty = new ElementImpl((ParentNode)detail,
+        OMElement faultDetailEnty = new NSAwareElement((ParentNode)detail,
                                                     SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY,
                                                     null, null, getOMFactory(), true);
         faultDetailEnty.setText(sw.getBuffer().toString());

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
Sun Aug 23 16:19:21 2015
@@ -24,13 +24,13 @@ import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.NSAwareElement;
 import org.apache.axiom.om.impl.dom.ParentNode;
 import org.apache.axiom.soap.SOAPCloneOptions;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axiom.soap.impl.common.AxiomSOAPHeaderBlock;
 
-public abstract class SOAPHeaderBlockImpl extends ElementImpl implements AxiomSOAPHeaderBlock
{
+public abstract class SOAPHeaderBlockImpl extends NSAwareElement implements AxiomSOAPHeaderBlock
{
     public SOAPHeaderBlockImpl(OMFactory factory) {
         super(factory);
     }

Modified: webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElement.java?rev=1697213&r1=1697212&r2=1697213&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElement.java
(original)
+++ webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElement.java
Sun Aug 23 16:19:21 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.axiom.ts.dom.document;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.apache.axiom.ts.dom.DOMTestCase;
@@ -33,7 +35,10 @@ public class TestCreateElement extends D
         String tagName = "LocalName";
         Document doc = dbf.newDocumentBuilder().newDocument();
         Element elem = doc.createElement(tagName);
-
-        assertEquals("Local name misnatch", tagName, elem.getNodeName());
+        assertThat(elem.getNodeName()).isEqualTo(tagName);
+        assertThat(elem.getTagName()).isEqualTo(tagName);
+        assertThat(elem.getPrefix()).isNull();
+        assertThat(elem.getLocalName()).isNull();
+        assertThat(elem.getNamespaceURI()).isNull();
     }
 }



Mime
View raw message