Author: ruchithf
Date: Wed Apr  5 08:48:00 2006
New Revision: 391646

URL: http://svn.apache.org/viewcvs?rev=391646&view=rev
Log:
- Fixed ElementImpl.cloneOMElement to use cloneNode
- When a child is added as as the last child make sure the next child is null
- createAttributeNS should be able to handle creating an attibute for the 
default namespace attr as well where the inputs are namespaceURI=null and 
qualifiedName=xmlns


Modified:
    
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java
    
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
    
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ParentNode.java

Modified: 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=391646&r1=391645&r2=391646&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java
 Wed Apr  5 08:48:00 2006
@@ -155,17 +155,17 @@
 
     public Attr createAttributeNS(String namespaceURI, String qualifiedName)
             throws DOMException {
-//        if (!namespaceURI.equals(OMConstants.XMLNS_NS_URI)) {
-            String localName = DOMUtil.getLocalName(qualifiedName);
-            String prefix = DOMUtil.getPrefix(qualifiedName);
+        String localName = DOMUtil.getLocalName(qualifiedName);
+        String prefix = DOMUtil.getPrefix(qualifiedName);
 
+        if(!OMConstants.XMLNS_NS_PREFIX.equals(localName)) {
             this.checkQName(prefix, localName);
+        } else {
+            return this.createAttribute(localName);
+        }
 
-            return new AttrImpl(this, localName, new NamespaceImpl(
-                    namespaceURI, prefix, this.factory), this.factory);
-//        } else {
-//            return null;
-//        }
+        return new AttrImpl(this, localName, new NamespaceImpl(
+                namespaceURI, prefix, this.factory), this.factory);
     }
 
     public CDATASection createCDATASection(String arg0) throws DOMException {

Modified: 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=391646&r1=391645&r2=391646&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
 Wed Apr  5 08:48:00 2006
@@ -1069,6 +1069,7 @@
             // switched off
             // has nothing to do if the element is already built!
             if (this.done) {
+                System.out.println(this.localName);
                 OMSerializerUtil.serializeStartpart(this, writer);
                 ChildNode child = this.firstChild;
                 while (child != null
@@ -1239,9 +1240,7 @@
      * @see org.apache.axiom.om.OMElement#cloneOMElement()
      */
     public OMElement cloneOMElement() {
-        ElementImpl elem = (ElementImpl) (new StAXOMBuilder(new OMDOMFactory(),
-                this.getXMLStreamReader(true))).getDocumentElement();
-        return elem;
+        return (ElementImpl)this.cloneNode(true);
     }
 
     public void setLineNumber(int lineNumber) {

Modified: 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ParentNode.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ParentNode.java?rev=391646&r1=391645&r2=391646&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ParentNode.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ParentNode.java
 Wed Apr  5 08:48:00 2006
@@ -199,6 +199,7 @@
                 newDomChild.previousSibling = this.lastChild;
 
                 this.lastChild = newDomChild;
+                this.lastChild.nextSibling = null;
             }
             if (newDomChild.parentNode == null) {
                 newDomChild.parentNode = this;


Reply via email to