You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ru...@apache.org on 2006/03/27 10:02:11 UTC

svn commit: r389047 [1/7] - in /webservices/commons/trunk/modules/axiom: ./ src/org/apache/axiom/om/impl/dom/ src/org/apache/axiom/om/impl/dom/factory/ src/org/apache/axiom/om/impl/dom/jaxp/ src/org/apache/axiom/om/impl/dom/msg/ src/org/apache/axiom/so...

Author: ruchithf
Date: Mon Mar 27 00:02:06 2006
New Revision: 389047

URL: http://svn.apache.org/viewcvs?rev=389047&view=rev
Log:
- Moving doom into ws-commons axiom from axis2


Added:
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttributeMap.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CharacterImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ChildNode.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMNavigator.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMUtil.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java
    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/NamedNodeMapImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NamespaceImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NodeListImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/OMDOMException.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/TextImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/XMLChar.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/factory/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/jaxp/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/msg/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/msg/DOMMessages.properties
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/msg/XMLMessages.properties
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/msg/XMLSerializerMessages.properties
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPElement.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPTextImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/factory/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11BodyImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultNodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultRoleImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultTextImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultValueImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderBlockImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12BodyImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/AbstractTestCase.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DocumentImplTest.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/ElementImplTest.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/MessagesTest.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMTestUtils.java
    webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/TextImplTest.java
Modified:
    webservices/commons/trunk/modules/axiom/maven.xml
    webservices/commons/trunk/modules/axiom/project.properties
    webservices/commons/trunk/modules/axiom/project.xml

Modified: webservices/commons/trunk/modules/axiom/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/maven.xml?rev=389047&r1=389046&r2=389047&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/maven.xml (original)
+++ webservices/commons/trunk/modules/axiom/maven.xml Mon Mar 27 00:02:06 2006
@@ -22,6 +22,8 @@
             <ant:fileset dir="target/classes">
                 <ant:exclude name="org/apache/ws/commons/soap/impl/llom/**"/>
                 <ant:exclude name="org/apache/ws/commons/om/impl/llom/**"/>
+				<ant:exclude name="org/apache/ws/commons/soap/impl/llom/**"/>
+                <ant:exclude name="org/apache/ws/commons/om/impl/llom/**"/>
             </ant:fileset>
         </jar>
         <jar destfile="target/axiom-impl-${axiom.version}.jar">
@@ -30,9 +32,16 @@
                 <ant:include name="org/apache/ws/commons/om/impl/llom/**"/>
             </ant:fileset>
         </jar>
+        <jar destfile="target/axiom-dom-${axiom.version}.jar">
+            <ant:fileset dir="target/classes">
+                <ant:include name="org/apache/ws/commons/soap/impl/dom/**"/>
+                <ant:include name="org/apache/ws/commons/om/impl/dom/**"/>
+            </ant:fileset>
+        </jar>
         <ant:copy toDir="${maven.repo.local}/ws-commons/jars">
             <ant:fileset file="target/axiom-api-${axiom.version}.jar"/>
             <ant:fileset file="target/axiom-impl-${axiom.version}.jar"/>
+			<ant:fileset file="target/axiom-dom-${axiom.version}.jar"/>
         </ant:copy>
 
     </postGoal>

Modified: webservices/commons/trunk/modules/axiom/project.properties
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/project.properties?rev=389047&r1=389046&r2=389047&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/project.properties (original)
+++ webservices/commons/trunk/modules/axiom/project.properties Mon Mar 27 00:02:06 2006
@@ -60,6 +60,7 @@
 #stax.impl.artifactid=wstx
 #stax.impl.version=asl-2.8.1
 xmlunit.version=1.0
+xml_apis.version=1.3.02
 
 stax.impl.groupid=stax
 stax.impl.artifactid=stax

Modified: webservices/commons/trunk/modules/axiom/project.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/project.xml?rev=389047&r1=389046&r2=389047&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/project.xml (original)
+++ webservices/commons/trunk/modules/axiom/project.xml Mon Mar 27 00:02:06 2006
@@ -322,6 +322,15 @@
                 <module>true</module>
             </properties>
         </dependency>
+		
+		<dependency>
+            <groupId>xml-apis</groupId>
+            <artifactId>xml-apis</artifactId>
+            <version>${xml_apis.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
     </dependencies>
 
 </project>

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,406 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.OMAttribute;
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.OMOutputImpl;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.TypeInfo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+/**
+ * Implementation of <code>org.w3c.dom.Attr</code> and
+ * <code>org.apache.axiom.om.OMAttribute</code>
+ */
+public class AttrImpl extends NodeImpl implements OMAttribute, Attr {
+
+    /**
+     * Name of the attribute
+     */
+    private String attrName;
+
+    /**
+     * Attribute value
+     */
+    private TextImpl attrValue;
+
+    /**
+     * Attribute namespace
+     */
+    private NamespaceImpl namespace;
+
+    /**
+     * Flag to indicate whether this attr is used or not
+     */
+    private boolean used;
+
+    /**
+     * Owner of this attribute
+     */
+    protected ParentNode parent;
+    
+    protected AttrImpl(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String localName,
+            OMNamespace ns, String value, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = localName;
+        this.attrValue = new TextImpl(ownerDocument, value, factory);
+        this.namespace = (NamespaceImpl) ns;
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String name, String value,
+            OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = name;
+        this.attrValue = new TextImpl(ownerDocument, value, factory);
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String name, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = name;
+        //If this is a default namespace attr
+        if(OMConstants.XMLNS_NS_PREFIX.equals(name)) {
+            this.namespace = new NamespaceImpl(
+                    OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX,
+                    this.factory);
+        }
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String localName,
+            OMNamespace namespace, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = localName;
+        this.namespace = (NamespaceImpl) namespace;
+    }
+
+    // /
+    // /org.w3c.dom.Node methods
+    // /
+    /**
+     * Returns the name of this attribute.
+     */
+    public String getNodeName() {
+        return (this.namespace != null
+                && !"".equals(this.namespace.getPrefix()) && !(OMConstants.XMLNS_NS_PREFIX.equals(this.attrName))) 
+                ? this.namespace.getPrefix()+ ":" + this.attrName
+                : this.attrName;
+    }
+
+    /**
+     * Returns the node type.
+     * 
+     * @see org.w3c.dom.Node#getNodeType()
+     */
+    public short getNodeType() {
+        return Node.ATTRIBUTE_NODE;
+    }
+
+    /**
+     * Returns the value of this attribute.
+     * 
+     * @see org.w3c.dom.Node#getNodeValue()
+     */
+    public String getNodeValue() throws DOMException {
+        return (this.attrValue == null) ? "" : this.attrValue.getData();
+    }
+
+    /**
+     * Returns the value of this attribute.
+     * 
+     * @see org.w3c.dom.Attr#getValue()
+     */
+    public String getValue() {
+        return (this.attrValue == null) ? null : this.attrValue.getText();
+    }
+
+    // /
+    // /org.w3c.dom.Attr methods
+    // /
+    public String getName() {
+        return (this.namespace == null) ? this.attrName
+                : OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName;
+    }
+
+    /**
+     * Returns the owner element.
+     * 
+     * @see org.w3c.dom.Attr#getOwnerElement()
+     */
+    public Element getOwnerElement() {
+        // Owned is set to an element instance when the attribute is added to an
+        // element
+        return (Element) (isOwned() ? ownerNode : null);
+    }
+
+    public boolean getSpecified() {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /**
+     * Not supported: Cannot detach attributes. Use the operations available in
+     * the owner node.
+     * 
+     * @see org.apache.axiom.om.OMNode#detach()
+     */
+    public OMNode detach() throws OMException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * Not supported: Cannot discard attributes. Use the operations available in
+     * the owner node.
+     * 
+     * @see org.apache.axiom.om.OMNode#discard()
+     */
+    public void discard() throws OMException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * Returns the type of this attribute node.
+     * 
+     * @see org.apache.axiom.om.OMNode#getType()
+     */
+    public int getType() {
+        return Node.ATTRIBUTE_NODE;
+    }
+
+    /**
+     * This is not supported since attributes serialization is handled by the
+     * serialization of the owner nodes.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#serialize
+     * (org.apache.axiom.om.impl.OMOutputImpl)
+     */
+    public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * This is not supported since attributes serialization is handled by the
+     * serialization of the owner nodes.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#serializeAndConsume
+     * (org.apache.axiom.om.impl.OMOutputImpl)
+     */
+    public void serializeAndConsume(OMOutputImpl omOutput)
+            throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * Returns the namespace of the attribute as an <code>OMNamespace</code>.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#getNamespace()
+     */
+    public OMNamespace getNamespace() {
+        return this.namespace;
+    }
+
+    /**
+     * Returns a qname representing the attribute.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#getQName()
+     */
+    public QName getQName() {
+        return (this.namespace == null) ? new QName(this.attrName) : new QName(
+                this.namespace.getName(), this.attrName, this.namespace
+                        .getPrefix());
+
+    }
+
+    /**
+     * Returns the attribute value.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#getAttributeValue()
+     */
+    public String getAttributeValue() {
+        return this.attrValue.getText();
+    }
+
+    /**
+     * Sets the name of attribute.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#setLocalName(java.lang.String)
+     */
+    public void setLocalName(String localName) {
+        this.attrName = localName;
+    }
+
+    /**
+     * Sets the namespace of this attribute node.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#setOMNamespace
+     * (org.apache.axiom.om.OMNamespace)
+     */
+    public void setOMNamespace(OMNamespace omNamespace) {
+        this.namespace = (NamespaceImpl) omNamespace;
+    }
+
+    /**
+     * Sets the attribute value.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#setAttributeValue(java.lang.String)
+     */
+    public void setAttributeValue(String value) {
+        if (isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode(
+                value);
+    }
+
+    /**
+     * Sets the parent element to the given OMContainer.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#setParent
+     * (org.apache.axiom.om.OMContainer)
+     */
+    public void setParent(OMContainer element) {
+        this.parent = (ParentNode) element;
+    }
+
+    /**
+     * Sets the type. NOT IMPLEMENTED: Unnecessary.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#setType(int)
+     */
+    public void setType(int nodeType) throws OMException {
+        // not necessary ???
+    }
+
+    /**
+     * @return Returns boolean.
+     */
+    protected boolean isUsed() {
+        return used;
+    }
+
+    /**
+     * @param used
+     *            The used to set.
+     */
+    protected void setUsed(boolean used) {
+        this.used = used;
+    }
+
+    /**
+     * Sets the value of the attribute.
+     * 
+     * @see org.w3c.dom.Attr#setValue(java.lang.String)
+     */
+    public void setValue(String value) throws DOMException {
+        this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode(
+                value);
+    }
+
+    /**
+     * Returns the parent node of this attribute.
+     * 
+     * @see org.apache.axiom.om.OMNode#getParent()
+     */
+    public OMContainer getParent() {
+        return this.parent;
+    }
+
+    /**
+     * Returns the attribute name.
+     * 
+     * @see org.w3c.dom.Node#getLocalName()
+     */
+    public String getLocalName() {
+        return (this.namespace == null) ? this.attrName : DOMUtil
+                .getLocalName(this.attrName);
+    }
+
+    /**
+     * Returns the namespace URI of this attr node.
+     * 
+     * @see org.w3c.dom.Node#getNamespaceURI()
+     */
+    public String getNamespaceURI() {
+        if (this.namespace != null) {
+            return namespace.getName();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the namespace prefix of this attr node.
+     * 
+     * @see org.w3c.dom.Node#getPrefix()
+     */
+    public String getPrefix() {
+        // TODO Error checking
+        return (this.namespace == null) ? null : this.namespace.getPrefix();
+    }
+
+    public Node cloneNode(boolean deep) {
+
+        AttrImpl clone = (AttrImpl) super.cloneNode(deep);
+
+        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) {
+                throw new UnsupportedOperationException(
+                        "Attribute value can contain only a text " +
+                        "node with out any siblings");
+            }
+        }
+        clone.isSpecified(true);
+        return clone;
+    }
+
+    /*
+     * DOM-Level 3 methods
+     */
+    public TypeInfo getSchemaTypeInfo() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean isId() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String toString() {
+        return (this.namespace == null) ? this.attrName : this.namespace
+                .getPrefix()
+                + ":" + this.attrName;
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttributeMap.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttributeMap.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttributeMap.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttributeMap.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.w3c.dom.DOMException;
+import org.w3c.dom.Node;
+
+import java.util.Vector;
+
+public class AttributeMap extends NamedNodeMapImpl {
+
+    /**
+     * @param ownerNode
+     */
+    protected AttributeMap(ParentNode ownerNode) {
+        super(ownerNode);
+    }
+
+    public Node removeNamedItem(String name) throws DOMException {
+        // TODO Set used to false
+        return super.removeNamedItem(name);
+    }
+
+    public Node removeNamedItemNS(String namespaceURI, String name)
+            throws DOMException {
+        // TODO
+        return super.removeNamedItemNS(namespaceURI, name);
+    }
+
+    /**
+     * Almost a copy of the Xerces impl.
+     */
+    public Node setNamedItem(Node attribute) throws DOMException {
+
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        if (attribute.getOwnerDocument() != ownerNode.getOwnerDocument()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+        }
+        if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR",
+                    null);
+            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
+        }
+
+        AttrImpl attr = (AttrImpl) attribute;
+        if (attr.isOwned()) { // If the attribute is owned then:
+            if (attr.getOwnerElement() != this.ownerNode) // the owner must be
+                                                            // the owner of this
+                                                            // list
+                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
+                        DOMMessageFormatter.formatMessage(
+                                DOMMessageFormatter.DOM_DOMAIN,
+                                "INUSE_ATTRIBUTE_ERR", null));
+            else
+                return attr; // No point adding the 'same' attr again to the
+                                // same element
+        }
+
+        attr.parent = this.ownerNode; // Set the owner node
+        attr.isOwned(true); // To indicate that this attr belong to an element
+        attr.setUsed(true); // Setting used to true
+
+        int i = findNamePoint(attr.getNodeName(), 0);
+
+        AttrImpl previous = null;
+        if (i >= 0) { // There's an attribute already with this attr's name
+            previous = (AttrImpl) nodes.elementAt(i);
+            nodes.setElementAt(attr, i);
+            previous.parent = this.ownerNode;
+            previous.isOwned(false);
+
+            // make sure it won't be mistaken with defaults in case it's reused
+            previous.isSpecified(true);
+        } else {
+            i = -1 - i; // Insert point (may be end of list)
+            if (null == nodes) {
+                nodes = new Vector(5, 10);
+            }
+            nodes.insertElementAt(attr, i);
+        }
+
+        // - Not sure whether we really need this
+        // // notify document
+        // ownerNode.getOwnerDocument().setAttrNode(attr, previous);
+
+        // If the new attribute is not normalized,
+        // the owning element is inherently not normalized.
+        if (!attr.isNormalized()) {
+            ownerNode.isNormalized(false);
+        }
+        return previous;
+
+    }
+
+    /**
+     * Almost a copy of the Xerces impl.
+     */
+    public Node setNamedItemNS(Node attribute) throws DOMException {
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        if (attribute.getOwnerDocument() != ownerNode.getOwnerDocument()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+        }
+        if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR",
+                    null);
+            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
+        }
+
+        AttrImpl attr = (AttrImpl) attribute;
+        if (attr.isOwned()) { // If the attribute is owned then:
+            //the owner must be the owner of this list
+            if (attr.getOwnerElement() != this.ownerNode) 
+                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
+                        DOMMessageFormatter.formatMessage(
+                                DOMMessageFormatter.DOM_DOMAIN,
+                                "INUSE_ATTRIBUTE_ERR", null));
+            else
+                return attr; // No point adding the 'same' attr again to the
+                                // same element
+        }
+        //Set the owner node
+        attr.ownerNode = (DocumentImpl) this.ownerNode.getOwnerDocument(); 
+        attr.isOwned(true); // To indicate that this attr belong to an element
+
+        int i = findNamePoint(attr.getNamespaceURI(), attr.getLocalName());
+        AttrImpl previous = null;
+
+        if (i >= 0) {
+            previous = (AttrImpl) nodes.elementAt(i);
+            nodes.setElementAt(attr, i);
+            previous.ownerNode = (DocumentImpl) this.ownerNode
+                    .getOwnerDocument();
+            previous.isOwned(false);
+            // make sure it won't be mistaken with defaults in case it's reused
+            previous.isSpecified(true);
+        } else {
+            // If we can't find by namespaceURI, localName, then we find by
+            // nodeName so we know where to insert.
+            i = findNamePoint(attr.getNodeName(), 0);
+            if (i >= 0) {
+                previous = (AttrImpl) nodes.elementAt(i);
+                nodes.insertElementAt(attr, i);
+            } else {
+                i = -1 - i; // Insert point (may be end of list)
+                if (null == nodes) {
+                    nodes = new Vector(5, 10);
+                }
+                nodes.insertElementAt(attr, i);
+            }
+        }
+
+        // If the new attribute is not normalized,
+        // the owning element is inherently not normalized.
+        if (!attr.isNormalized()) {
+            ownerNode.isNormalized(false);
+        }
+        return previous;
+    }
+
+    /**
+     * BORROWED from Xerces impl. Cloning a NamedNodeMap is a DEEP OPERATION; it
+     * always clones all the nodes contained in the map.
+     */
+
+    public NamedNodeMapImpl cloneMap(NodeImpl ownerNode) {
+        AttributeMap newmap = new AttributeMap((ParentNode) ownerNode);
+        newmap.hasDefaults(hasDefaults());
+        newmap.cloneContent(this);
+        return newmap;
+    } // cloneMap():AttributeMap
+
+    /**
+     * BORROWED from Xerces impl.
+     */
+    protected void cloneContent(NamedNodeMapImpl srcmap) {
+        Vector srcnodes = srcmap.nodes;
+        if (srcnodes != null) {
+            int size = srcnodes.size();
+            if (size != 0) {
+                if (nodes == null) {
+                    nodes = new Vector(size);
+                }
+                nodes.setSize(size);
+                for (int i = 0; i < size; ++i) {
+                    NodeImpl n = (NodeImpl) srcnodes.elementAt(i);
+                    NodeImpl clone = (NodeImpl) n.cloneNode(true);
+                    clone.isSpecified(n.isSpecified());
+                    nodes.setElementAt(clone, i);
+                    clone.ownerNode = this.ownerNode.ownerNode;
+                    clone.isOwned(true);
+                }
+            }
+        }
+    } // cloneContent():AttributeMap
+
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CharacterImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CharacterImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CharacterImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CharacterImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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;
+import org.w3c.dom.CharacterData;
+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 {
+
+	protected StringBuffer textValue;
+	
+	protected CharacterImpl(OMFactory factory) {
+        super(factory);
+	}
+	
+	/**
+	 * @param ownerNode
+	 */
+	public CharacterImpl(DocumentImpl ownerNode, OMFactory factory) {
+		super(ownerNode, factory);
+	}
+
+	public CharacterImpl(DocumentImpl ownerNode, String value, OMFactory factory){
+		super(ownerNode, factory);
+		this.textValue = new StringBuffer(value);
+	}
+	
+	///
+	///org.w3c.dom.CharacterData mrthods
+	///
+	
+	public void appendData(String value) throws DOMException {
+		
+		if (this.isReadonly()) {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+		
+		this.textValue.append(value);
+	}
+	
+	/**
+	 * 
+	 */
+	public void deleteData(int offset, int count) throws DOMException {
+		this.replaceData(offset,count,null);
+	}
+	
+	/**
+	 * If the given data is null the content will be deleted.
+	 */
+	public void replaceData(int offset, int count, String data) throws
+                                                             DOMException {
+		
+		if (this.isReadonly()) {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+			
+		int length = this.textValue.length();
+		if (offset < 0 || offset > length - 1 || count < 0) {
+			throw new DOMException(DOMException.INDEX_SIZE_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
+							null));
+		} else {
+
+			int end = Math.min(count + offset, length);
+
+			if (data == null) {
+				this.textValue.delete(offset, end);
+			} else {
+				this.textValue.replace(offset, end, data);
+			}
+		}
+
+	}
+	
+	
+	
+	/**
+	 * Returns the value of the data.
+	 */
+	public String getData() throws DOMException {
+		return (this.textValue != null) ? this.textValue.toString() : "";
+	}
+	
+	/**
+	 * Inserts a string at the specified offset.
+	 */
+	public void insertData(int offset, String data) throws DOMException {
+		int length = this.textValue.length();
+		
+		if (this.isReadonly()) {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+		
+		if(offset < 0 || offset > length-1) {
+			throw new DOMException(DOMException.INDEX_SIZE_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"INDEX_SIZE_ERR", null));
+		}
+		
+		this.textValue.insert(offset,data);
+
+	}
+
+	/**
+	 * Sets the text value of data.
+	 */
+	public void setData(String data) throws DOMException {
+		if (!this.isReadonly()) {
+			this.textValue.replace(0,textValue.length(), data);
+		} else {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+	}
+	
+	/**
+	 * Extracts a range of data from the node.
+	 * @return Returns the specified substring. If the sum of offset and count 
+     * exceeds the length, then all 16-bit units to the end of the data are 
+     * returned.
+	 */
+	public String substringData(int offset, int count) throws DOMException {
+		if(offset < 0 || offset > this.textValue.length() || count < 0) {
+			throw new DOMException(DOMException.INDEX_SIZE_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"INDEX_SIZE_ERR", null));
+		}
+		
+		int end = Math.min( count + offset, textValue.length());
+		return this.textValue.substring(offset, end);
+	}
+	
+	/**
+	 * Returns the length of the string value.
+	 */
+	public int getLength() {
+		return this.textValue.length();
+	}
+		
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ChildNode.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ChildNode.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ChildNode.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ChildNode.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.w3c.dom.Node;
+
+public abstract class ChildNode extends NodeImpl {
+
+    protected ChildNode previousSibling;
+
+    protected ChildNode nextSibling;
+
+    protected ParentNode parentNode;
+
+    /**
+     * @param ownerDocument
+     */
+    protected ChildNode(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    protected ChildNode(OMFactory factory) {
+        super(factory);
+    }
+
+    public OMNode getNextOMSibling() throws OMException {
+        while ((nextSibling == null) && !this.parentNode.done) {
+            this.parentNode.buildNext();
+        }
+        return nextSibling;
+    }
+
+    public Node getNextSibling() {
+        return (Node) this.getNextOMSibling();
+    }
+
+    public OMNode getPreviousOMSibling() {
+        return this.previousSibling;
+    }
+
+    public Node getPreviousSibling() {
+        return this.previousSibling;
+    }
+
+    // /
+    // /OMNode methods
+    // /
+    public void setNextOMSibling(OMNode node) {
+        if (node == null) {
+            this.nextSibling = null;
+            return;
+        }
+        if (node instanceof ChildNode) {
+            this.nextSibling = (ChildNode) node;
+        } else {
+            throw new OMException("The node is not a " + ChildNode.class);
+        }
+    }
+
+    public void setPreviousOMSibling(OMNode node) {
+        if (node == null) {
+            this.previousSibling = null;
+            return;
+        }
+        if (node instanceof ChildNode) {
+            this.previousSibling = (ChildNode) node;
+        } else {
+            throw new OMException("The node is not a " + ChildNode.class);
+        }
+    }
+
+    public OMContainer getParent() throws OMException {
+        return this.parentNode;
+    }
+
+    public Node getParentNode() {
+        return this.parentNode;
+    }
+
+    public void setParent(OMContainer element) {
+        if (element instanceof ParentNode) {
+            this.parentNode = (ParentNode) element;
+        } else {
+            throw new OMException("The given parent is not of the type "
+                                  + ParentNode.class);
+        }
+
+    }
+
+    public OMNode detach() throws OMException {
+        if (this.parentNode == null) {
+            throw new OMException("Parent level elements cannot be detached");
+        } else {
+            if (previousSibling == null) { // This is the first child
+                if (nextSibling != null) {
+                    this.parentNode.setFirstChild(nextSibling);
+                } else {
+                    this.parentNode.firstChild = null;
+                    this.parentNode.lastChild = null;
+                }
+            } else {
+                this.previousSibling.setNextOMSibling(nextSibling);
+                if(nextSibling == null){
+                    this.previousSibling.parentNode.done = true;
+                }
+            }
+            if (this.nextSibling != null) {
+                this.nextSibling.setPreviousOMSibling(this.previousSibling);
+            }
+            if (this.parentNode != null && this.parentNode.lastChild == this) {
+                this.parentNode.lastChild = previousSibling;
+            }
+            this.parentNode = null;
+        }
+        return this;
+    }
+
+    public void discard() throws OMException {
+        throw new UnsupportedOperationException("Cannot discard this node");
+    }
+
+    /**
+     * Inserts the given sibling next to this item.
+     */
+    public void insertSiblingAfter(OMNode sibling) throws OMException {
+
+        if (this.parentNode != null) {
+            ((OMNodeEx) sibling).setParent(this.parentNode);
+        }
+
+        if (sibling instanceof ChildNode) {
+            ChildNode domSibling = (ChildNode) sibling;
+            domSibling.previousSibling = this;
+            if (this.nextSibling != null) {
+                this.nextSibling.previousSibling = domSibling;
+            }
+            domSibling.nextSibling = this.nextSibling;
+            this.nextSibling = domSibling;
+
+        } else {
+            throw new OMException("The given child is not of type "
+                                  + ChildNode.class);
+        }
+    }
+
+    /**
+     * Inserts the given sibling before this item.
+     */
+    public void insertSiblingBefore(OMNode sibling) throws OMException {
+        // ((OMNodeEx)sibling).setParent(this.parentNode);
+        if (sibling instanceof ChildNode) {
+            // ChildNode domSibling = (ChildNode)sibling;
+            // domSibling.nextSibling = this;
+            // if(this.previousSibling != null) {
+            // this.previousSibling.nextSibling = domSibling;
+            // }
+            // domSibling.previousSibling = this.previousSibling;
+            // this.previousSibling = domSibling;
+            ChildNode siblingImpl = (ChildNode) sibling;
+            siblingImpl.nextSibling = this;
+            if (previousSibling == null) {
+                this.parentNode.setFirstChild(siblingImpl);
+                siblingImpl.previousSibling = null;
+            } else {
+                siblingImpl.setParent(this.parentNode);
+                previousSibling.setNextOMSibling(siblingImpl);
+                siblingImpl.setPreviousOMSibling(previousSibling);
+            }
+            previousSibling = siblingImpl;
+
+        } else {
+            throw new OMException("The given child is not of type "
+                                  + ChildNode.class);
+        }
+
+    }
+
+    public Node cloneNode(boolean deep) {
+
+        ChildNode newnode = (ChildNode) super.cloneNode(deep);
+
+        // Need to break the association w/ original kids
+        newnode.previousSibling = null;
+        newnode.nextSibling = null;
+        newnode.isFirstChild(false);
+
+        return newnode;
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.OMComment;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.OMOutputImpl;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Node;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class CommentImpl extends CharacterImpl implements Comment, OMComment {
+
+    public CommentImpl(DocumentImpl ownerNode, OMFactory factory) {
+        super(ownerNode, factory);
+        this.done = true;
+    }
+
+    public CommentImpl(DocumentImpl ownerNode, String value, OMFactory factory) {
+        super(ownerNode, value, factory);
+        this.done = true;
+    }
+
+    public String getNodeName() {
+        return "#comment";
+    }
+
+    public short getNodeType() {
+        return Node.COMMENT_NODE;
+    }
+
+    public String getValue() {
+        return this.getData();
+    }
+
+    public void setValue(String text) {
+        this.textValue.delete(0, this.textValue.length());
+        this.textValue.append(text);
+    }
+
+    public int getType() {
+        return Node.COMMENT_NODE;
+    }
+
+    public void setType(int nodeType) throws OMException {
+        throw new UnsupportedOperationException(
+                "You should not set the node type of a comment");
+    }
+
+    public void serialize(OMOutputImpl omOutput) throws XMLStreamException {
+        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+        writer.writeComment(this.textValue.toString());
+    }
+
+    public void serializeAndConsume(OMOutputImpl omOutput)
+            throws XMLStreamException {
+        serialize(omOutput);
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+
+public class DOMImplementationImpl implements DOMImplementation {
+
+    public boolean hasFeature(String arg0, String arg1) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Document createDocument(String namespaceURI, String qualifiedName,
+            DocumentType doctype) throws DOMException {
+        
+        // TODO Handle docType stuff
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+        fac.setDocument(doc);
+
+        new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName),
+                new NamespaceImpl(namespaceURI, DOMUtil
+                        .getPrefix(qualifiedName),fac),fac);
+
+        return doc;
+    }
+
+    public DocumentType createDocumentType(String qualifiedName,
+            String publicId, String systemId) throws DOMException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /*
+     * DOM-Level 3 methods
+     */
+
+    public Object getFeature(String arg0, String arg1) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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 java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+
+/**
+ * Used to format DOM error messages, using the system locale.
+ */
+public class DOMMessageFormatter {
+    public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR";
+
+    public static final String XML_DOMAIN = 
+                                "http://www.w3.org/TR/1998/REC-xml-19980210";
+
+    public static final String SERIALIZER_DOMAIN = 
+                                "http://apache.org/xml/serializer";
+
+    private static ResourceBundle domResourceBundle = null;
+
+    private static ResourceBundle xmlResourceBundle = null;
+
+    private static ResourceBundle serResourceBundle = null;
+
+    private static Locale locale = null;
+
+    public static final String LEVEL3_NOT_SUPPORTED = 
+                                "DOM Level 3 operations are not supported";
+
+    public static final String NOT_REQUIRED_FOR_XMLSEC_OR_WSS4J = 
+            "This method is not required by Apache XML-Security Impl or WSS4J";
+
+    DOMMessageFormatter() {
+        locale = Locale.getDefault();
+    }
+
+    /**
+     * Formats a message with the specified arguments using the given locale
+     * information.
+     * 
+     * @param domain
+     *            domain from which error string is to come.
+     * @param key
+     *            The message key.
+     * @param arguments
+     *            The message replacement text arguments. The order of the
+     *            arguments must match that of the placeholders in the actual
+     *            message.
+     * 
+     * @return Returns the formatted message.
+     * 
+     * @throws MissingResourceException
+     *             Thrown if the message with the specified key cannot be found.
+     */
+    public static String formatMessage(String domain, String key,
+            Object[] arguments) throws MissingResourceException {
+        ResourceBundle resourceBundle = getResourceBundle(domain);
+        if (resourceBundle == null) {
+            init();
+            resourceBundle = getResourceBundle(domain);
+            if (resourceBundle == null)
+                throw new MissingResourceException("Unknown domain" + domain,
+                        null, key);
+        }
+        // format message
+        String msg;
+        try {
+            msg = key + ": " + resourceBundle.getString(key);
+            if (arguments != null) {
+                try {
+                    msg = java.text.MessageFormat.format(msg, arguments);
+                } catch (Exception e) {
+                    msg = resourceBundle.getString("FormatFailed");
+                    msg += " " + resourceBundle.getString(key);
+                }
+            }
+        } // error
+        catch (MissingResourceException e) {
+            msg = resourceBundle.getString("BadMessageKey");
+            throw new MissingResourceException(key, msg, key);
+        }
+
+        // no message
+        if (msg == null) {
+            msg = key;
+            if (arguments.length > 0) {
+                StringBuffer str = new StringBuffer(msg);
+                str.append('?');
+                for (int i = 0; i < arguments.length; i++) {
+                    if (i > 0) {
+                        str.append('&');
+                    }
+                    str.append(String.valueOf(arguments[i]));
+                }
+            }
+        }
+
+        return msg;
+    }
+
+    static ResourceBundle getResourceBundle(String domain) {
+        if (domain == DOM_DOMAIN || domain.equals(DOM_DOMAIN))
+            return domResourceBundle;
+        else if (domain == XML_DOMAIN || domain.equals(XML_DOMAIN))
+            return xmlResourceBundle;
+        else if (domain == SERIALIZER_DOMAIN
+                || domain.equals(SERIALIZER_DOMAIN))
+            return serResourceBundle;
+        return null;
+    }
+
+    /**
+     * Initializes Message Formatter.
+     */
+    public static void init() {
+        if (locale != null) {
+            domResourceBundle = PropertyResourceBundle.getBundle(
+                    "org.apache.axis2.om.impl.dom.msg.DOMMessages", locale);
+            serResourceBundle = PropertyResourceBundle.getBundle(
+                    "org.apache.axis2.om.impl.dom.msg.XMLSerializerMessages",
+                    locale);
+            xmlResourceBundle = PropertyResourceBundle.getBundle(
+                    "org.apache.axis2.om.impl.dom.msg.XMLMessages", locale);
+        } else {
+            domResourceBundle = PropertyResourceBundle
+                    .getBundle("org.apache.axis2.om.impl.dom.msg.DOMMessages");
+            serResourceBundle = PropertyResourceBundle
+                    .getBundle("org.apache.axis2.om.impl.dom.msg.XMLSerializerMessages");
+            xmlResourceBundle = PropertyResourceBundle
+                    .getBundle("org.apache.axis2.om.impl.dom.msg.XMLMessages");
+        }
+    }
+
+    /**
+     * Sets Locale to be used by the formatter.
+     * 
+     * @param dlocale
+     */
+    public static void setLocale(Locale dlocale) {
+        locale = dlocale;
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMNavigator.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMNavigator.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DOMNavigator.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+
+/**
+ * This is exactly the same as org.apache.axiom.om.impl.om.OMNavigator, only the
+ * llom specifics are changed to dom. Refer to the testClass to find out how to
+ * use features like isNavigable, isComplete and step.
+ */
+public class DOMNavigator {
+    /**
+     * Field node
+     */
+    protected OMNode node;
+
+    /**
+     * Field visited
+     */
+    private boolean visited;
+
+    /**
+     * Field next
+     */
+    private OMNode next;
+
+    // root is the starting element. Once the navigator comes back to the
+    // root, the traversal is terminated
+
+    /**
+     * Field root
+     */
+    private OMNode root;
+
+    /**
+     * Field backtracked
+     */
+    private boolean backtracked;
+
+    // flags that tell the status of the navigator
+
+    /**
+     * Field end
+     */
+    private boolean end = false;
+
+    /**
+     * Field start
+     */
+    private boolean start = true;
+
+    /**
+     * Constructor OMNavigator.
+     */
+    public DOMNavigator() {
+    }
+
+    /**
+     * Constructor OMNavigator.
+     * 
+     * @param node
+     */
+    public DOMNavigator(OMNode node) {
+        init(node);
+    }
+
+    /**
+     * Method init.
+     * 
+     * @param node
+     */
+    public void init(OMNode node) {
+        next = node;
+        root = node;
+        backtracked = false;
+    }
+
+    /**
+     * Gets the next node.
+     * 
+     * @return Returns OMNode in the sequence of preorder traversal. Note
+     *         however that an element node is treated slightly differently.
+     *         Once the element is passed it returns the same element in the
+     *         next encounter as well.
+     */
+    public OMNode next() {
+        if (next == null) {
+            return null;
+        }
+        node = next;
+        visited = backtracked;
+        backtracked = false;
+        updateNextNode();
+
+        // set the starting and ending flags
+        if (root.equals(node)) {
+            if (!start) {
+                end = true;
+            } else {
+                start = false;
+            }
+        }
+        return node;
+    }
+
+    /**
+     * Private method to encapsulate the searching logic
+     */
+    private void updateNextNode() {
+        if ((next instanceof OMElement) && !visited) {
+            ElementImpl e = (ElementImpl) next;
+            if (e.firstChild != null) {
+                next = e.firstChild;
+            } else if (e.isComplete()) {
+                backtracked = true;
+            } else {
+                next = null;
+            }
+        } else {
+            OMNode nextSibling = ((ChildNode) next).nextSibling;
+            OMContainer parent = next.getParent();
+            if (nextSibling != null) {
+                next = nextSibling;
+            } else if ((parent != null) && parent.isComplete()) {
+                next = (NodeImpl) parent;
+                backtracked = true;
+            } else {
+                next = null;
+            }
+        }
+    }
+
+    /**
+     * Method visited.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean visited() {
+        return visited;
+    }
+
+    /**
+     * This is a very special method. This allows the navigator to step once it
+     * has reached the existing OM. At this point the isNavigable method will
+     * return false but the isComplete method may return false which means that
+     * the navigating the given element is not complete but the navigator cannot
+     * proceed.
+     */
+    public void step() {
+        if (!end) {
+            next = node;
+            updateNextNode();
+        }
+    }
+
+    /**
+     * Returns the navigable status.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isNavigable() {
+        if (end) {
+            return false;
+        } else {
+            return !(next == null);
+        }
+    }
+
+    /**
+     * Returns the completed status.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isCompleted() {
+        return end;
+    }
+}