You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/09/15 21:07:03 UTC

svn commit: r289289 [121/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/a...

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java Thu Sep 15 11:52:11 2005
@@ -1,411 +1,411 @@
-/*
- * 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.axis2.om.impl.llom.builder;
-
-import org.apache.axis2.om.*;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * OM should be able to built from any data source. And the model it builds may be a SOAP specific one
- * or just an XML model. This class will give some common functionality of OM Building from StAX.
- */
-public abstract class StAXBuilder implements OMXMLParserWrapper {
-
-    /**
-     * Field parser
-     */
-    protected XMLStreamReader parser;
-
-    /**
-     * Field omfactory
-     */
-    protected OMFactory omfactory;
-
-    /**
-     * Field lastNode
-     */
-    protected OMNode lastNode;
-
-    // returns the state of completion
-
-    /**
-     * Field done
-     */
-    protected boolean done = false;
-
-    // keeps the state of the cache
-
-    /**
-     * Field cache
-     */
-    protected boolean cache = true;
-
-    // keeps the state of the parser access. if the parser is
-    // accessed atleast once,this flag will be set
-
-    /**
-     * Field parserAccessed
-     */
-    protected boolean parserAccessed = false;
-    protected OMDocument document;
-
-
-
-    /**
-     * Constructor StAXBuilder
-     *
-     * @param ombuilderFactory
-     * @param parser
-     */
-    protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
-        this.parser = parser;
-        omfactory = ombuilderFactory;
-    }
-
-    /**
-     * Constructor StAXBuilder
-     *
-     * @param parser
-     */
-    protected StAXBuilder(XMLStreamReader parser) {
-        this(OMAbstractFactory.getOMFactory(), parser);
-    }
-
-    /**
-     * Method setOmbuilderFactory
-     *
-     * @param ombuilderFactory
-     */
-    public void setOmbuilderFactory(OMFactory ombuilderFactory) {
-        this.omfactory = ombuilderFactory;
-    }
-
-    /**
-     * Method processNamespaceData
-     *
-     * @param node
-     * @param isSOAPElement
-     */
-    protected abstract void processNamespaceData(OMElement node,
-                                                 boolean isSOAPElement);
-
-    // since the behaviors are different when it comes to namespaces
-    // this must be implemented differently
-
-    /**
-     * Method processAttributes
-     *
-     * @param node
-     */
-    protected void processAttributes(OMElement node) {
-        int attribCount = parser.getAttributeCount();
-        for (int i = 0; i < attribCount; i++) {
-            OMNamespace ns = null;
-            String uri = parser.getAttributeNamespace(i);
-            String prefix = parser.getAttributePrefix(i);
-            if (uri != null && uri.hashCode() != 0) {
-                ns = node.findNamespace(uri, prefix);
-            }
-            // todo if the attributes are supposed to namespace qualified all the time
-            // todo then this should throw an exception here
-            node.addAttribute(parser.getAttributeLocalName(i),
-                    parser.getAttributeValue(i), ns);
-        }
-    }
-
-    /**
-     * Method createOMText
-     *
-     * @return
-     * @throws OMException
-     */
-    protected OMNode createOMText(int textType) throws OMException {
-        OMNode node = null;
-        if (lastNode == null) {
-            return null;
-        } else if (!lastNode.isComplete()) {
-            node = omfactory.createText((OMElement) lastNode, parser.getText());
-            node.setType(textType);
-        } else if (!(lastNode.getParent() instanceof OMDocument)) {
-            node = omfactory.createText((OMElement)lastNode.getParent(), parser.getText());
-            node.setType(textType);
-        }
-        return node;
-    }
-
-    /**
-     * Method reset
-     *
-     * @param node
-     * @throws OMException
-     */
-    public void reset(OMNode node) throws OMException {
-        lastNode = null;
-    }
-
-    /**
-     * Method discard
-     *
-     * @param el
-     * @throws OMException
-     */
-    public void discard(OMElement el) throws OMException {
-        OMElement element = null;
-
-        if (element.isComplete() || !cache) {
-            throw new OMException();
-        }
-        try {
-            cache = false;
-            do {
-                while (parser.next() != XMLStreamConstants.END_ELEMENT) ;
-
-                // TODO:
-            } while (!parser.getName().equals(element.getQName()));
-            lastNode = element.getPreviousSibling();
-            if (lastNode != null) {
-                lastNode.setNextSibling(null);
-            } else {
-                OMElement parent = (OMElement) element.getParent();
-                if (parent == null) {
-                    throw new OMException();
-                }
-                parent.setFirstChild(null);
-                lastNode = parent;
-            }
-            cache = true;
-        } catch (OMException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new OMException(e);
-        }
-    }
-
-    /**
-     * Method getText
-     *
-     * @return
-     * @throws OMException
-     */
-    public String getText() throws OMException {
-        return parser.getText();
-    }
-
-    /**
-     * Method getNamespace
-     *
-     * @return
-     * @throws OMException
-     */
-    public String getNamespace() throws OMException {
-        return parser.getNamespaceURI();
-    }
-
-    /**
-     * Method getNamespaceCount
-     *
-     * @return
-     * @throws OMException
-     */
-    public int getNamespaceCount() throws OMException {
-        try {
-            return parser.getNamespaceCount();
-        } catch (Exception e) {
-            throw new OMException(e);
-        }
-    }
-
-    /**
-     * Method getNamespacePrefix
-     *
-     * @param index
-     * @return
-     * @throws OMException
-     */
-    public String getNamespacePrefix(int index) throws OMException {
-        try {
-            return parser.getNamespacePrefix(index);
-        } catch (Exception e) {
-            throw new OMException(e);
-        }
-    }
-
-    /**
-     * Method getNamespaceUri
-     *
-     * @param index
-     * @return
-     * @throws OMException
-     */
-    public String getNamespaceUri(int index) throws OMException {
-        try {
-            return parser.getNamespaceURI(index);
-        } catch (Exception e) {
-            throw new OMException(e);
-        }
-    }
-
-    /**
-     * Method setCache
-     *
-     * @param b
-     */
-    public void setCache(boolean b) {
-        if (parserAccessed && b) {
-            throw new UnsupportedOperationException(
-                    "parser accessed. cannot set cache");
-        }
-        cache = b;
-    }
-
-    /**
-     * Method getName
-     *
-     * @return
-     * @throws OMException
-     */
-    public String getName() throws OMException {
-        return parser.getLocalName();
-    }
-
-    /**
-     * Method getPrefix
-     *
-     * @return
-     * @throws OMException
-     */
-    public String getPrefix() throws OMException {
-        return parser.getPrefix();
-    }
-
-    /**
-     * Method getAttributeCount
-     *
-     * @return
-     * @throws OMException
-     */
-    public int getAttributeCount() throws OMException {
-        return parser.getAttributeCount();
-    }
-
-    /**
-     * Method getAttributeNamespace
-     *
-     * @param arg
-     * @return
-     * @throws OMException
-     */
-    public String getAttributeNamespace(int arg) throws OMException {
-        return parser.getAttributeNamespace(arg);
-    }
-
-    /**
-     * Method getAttributeName
-     *
-     * @param arg
-     * @return
-     * @throws OMException
-     */
-    public String getAttributeName(int arg) throws OMException {
-        return parser.getAttributeNamespace(arg);
-    }
-
-    /**
-     * Method getAttributePrefix
-     *
-     * @param arg
-     * @return
-     * @throws OMException
-     */
-    public String getAttributePrefix(int arg) throws OMException {
-        return parser.getAttributeNamespace(arg);
-    }
-
-    /**
-     * Method getParser
-     *
-     * @return
-     */
-    public Object getParser() {
-        if (!cache) {
-            parserAccessed = true;
-            return parser;
-        } else {
-            throw new UnsupportedOperationException(
-                    "cache must be switched off to access the parser");
-        }
-    }
-
-    /**
-     * Method isCompleted
-     *
-     * @return
-     */
-    public boolean isCompleted() {
-        return done;
-    }
-
-    /**
-     * This method will be called with the XMLStreamConstants.START_ELEMENT event
-     *
-     * @return
-     * @throws OMException
-     */
-    protected abstract OMNode createOMElement() throws OMException;
-
-    /**
-     * This should proceed the parser one step further, if parser is not completed yet.
-     * If this has been called whist parser is done, then throw an OMException.
-     * If the cache is set to false, then should be return the event, *without* building the OM tree.
-     * If the cache is set to true, then this should handle all the events within this, and should build
-     * the object structure appropriately and return the event.
-     *
-     * @return
-     * @throws OMException
-     */
-    public abstract int next() throws OMException;
-
-    /**
-     * @return
-     */
-    public short getBuilderType() {
-        return OMConstants.PULL_TYPE_BUILDER;
-    }
-
-    /**
-     * Method registerExternalContentHandler
-     *
-     * @param obj
-     */
-    public void registerExternalContentHandler(Object obj) {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Method getRegisteredContentHandler
-     *
-     * @return
-     */
-    public Object getRegisteredContentHandler() {
-        throw new UnsupportedOperationException();
-    }
-
-    public OMDocument getDocument() {
-        return document;
-    }
-}
+/*
+ * 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.axis2.om.impl.llom.builder;
+
+import org.apache.axis2.om.*;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * OM should be able to built from any data source. And the model it builds may be a SOAP specific one
+ * or just an XML model. This class will give some common functionality of OM Building from StAX.
+ */
+public abstract class StAXBuilder implements OMXMLParserWrapper {
+
+    /**
+     * Field parser
+     */
+    protected XMLStreamReader parser;
+
+    /**
+     * Field omfactory
+     */
+    protected OMFactory omfactory;
+
+    /**
+     * Field lastNode
+     */
+    protected OMNode lastNode;
+
+    // returns the state of completion
+
+    /**
+     * Field done
+     */
+    protected boolean done = false;
+
+    // keeps the state of the cache
+
+    /**
+     * Field cache
+     */
+    protected boolean cache = true;
+
+    // keeps the state of the parser access. if the parser is
+    // accessed atleast once,this flag will be set
+
+    /**
+     * Field parserAccessed
+     */
+    protected boolean parserAccessed = false;
+    protected OMDocument document;
+
+
+
+    /**
+     * Constructor StAXBuilder
+     *
+     * @param ombuilderFactory
+     * @param parser
+     */
+    protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
+        this.parser = parser;
+        omfactory = ombuilderFactory;
+    }
+
+    /**
+     * Constructor StAXBuilder
+     *
+     * @param parser
+     */
+    protected StAXBuilder(XMLStreamReader parser) {
+        this(OMAbstractFactory.getOMFactory(), parser);
+    }
+
+    /**
+     * Method setOmbuilderFactory
+     *
+     * @param ombuilderFactory
+     */
+    public void setOmbuilderFactory(OMFactory ombuilderFactory) {
+        this.omfactory = ombuilderFactory;
+    }
+
+    /**
+     * Method processNamespaceData
+     *
+     * @param node
+     * @param isSOAPElement
+     */
+    protected abstract void processNamespaceData(OMElement node,
+                                                 boolean isSOAPElement);
+
+    // since the behaviors are different when it comes to namespaces
+    // this must be implemented differently
+
+    /**
+     * Method processAttributes
+     *
+     * @param node
+     */
+    protected void processAttributes(OMElement node) {
+        int attribCount = parser.getAttributeCount();
+        for (int i = 0; i < attribCount; i++) {
+            OMNamespace ns = null;
+            String uri = parser.getAttributeNamespace(i);
+            String prefix = parser.getAttributePrefix(i);
+            if (uri != null && uri.hashCode() != 0) {
+                ns = node.findNamespace(uri, prefix);
+            }
+            // todo if the attributes are supposed to namespace qualified all the time
+            // todo then this should throw an exception here
+            node.addAttribute(parser.getAttributeLocalName(i),
+                    parser.getAttributeValue(i), ns);
+        }
+    }
+
+    /**
+     * Method createOMText
+     *
+     * @return
+     * @throws OMException
+     */
+    protected OMNode createOMText(int textType) throws OMException {
+        OMNode node = null;
+        if (lastNode == null) {
+            return null;
+        } else if (!lastNode.isComplete()) {
+            node = omfactory.createText((OMElement) lastNode, parser.getText());
+            node.setType(textType);
+        } else if (!(lastNode.getParent() instanceof OMDocument)) {
+            node = omfactory.createText((OMElement)lastNode.getParent(), parser.getText());
+            node.setType(textType);
+        }
+        return node;
+    }
+
+    /**
+     * Method reset
+     *
+     * @param node
+     * @throws OMException
+     */
+    public void reset(OMNode node) throws OMException {
+        lastNode = null;
+    }
+
+    /**
+     * Method discard
+     *
+     * @param el
+     * @throws OMException
+     */
+    public void discard(OMElement el) throws OMException {
+        OMElement element = null;
+
+        if (element.isComplete() || !cache) {
+            throw new OMException();
+        }
+        try {
+            cache = false;
+            do {
+                while (parser.next() != XMLStreamConstants.END_ELEMENT) ;
+
+                // TODO:
+            } while (!parser.getName().equals(element.getQName()));
+            lastNode = element.getPreviousSibling();
+            if (lastNode != null) {
+                lastNode.setNextSibling(null);
+            } else {
+                OMElement parent = (OMElement) element.getParent();
+                if (parent == null) {
+                    throw new OMException();
+                }
+                parent.setFirstChild(null);
+                lastNode = parent;
+            }
+            cache = true;
+        } catch (OMException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new OMException(e);
+        }
+    }
+
+    /**
+     * Method getText
+     *
+     * @return
+     * @throws OMException
+     */
+    public String getText() throws OMException {
+        return parser.getText();
+    }
+
+    /**
+     * Method getNamespace
+     *
+     * @return
+     * @throws OMException
+     */
+    public String getNamespace() throws OMException {
+        return parser.getNamespaceURI();
+    }
+
+    /**
+     * Method getNamespaceCount
+     *
+     * @return
+     * @throws OMException
+     */
+    public int getNamespaceCount() throws OMException {
+        try {
+            return parser.getNamespaceCount();
+        } catch (Exception e) {
+            throw new OMException(e);
+        }
+    }
+
+    /**
+     * Method getNamespacePrefix
+     *
+     * @param index
+     * @return
+     * @throws OMException
+     */
+    public String getNamespacePrefix(int index) throws OMException {
+        try {
+            return parser.getNamespacePrefix(index);
+        } catch (Exception e) {
+            throw new OMException(e);
+        }
+    }
+
+    /**
+     * Method getNamespaceUri
+     *
+     * @param index
+     * @return
+     * @throws OMException
+     */
+    public String getNamespaceUri(int index) throws OMException {
+        try {
+            return parser.getNamespaceURI(index);
+        } catch (Exception e) {
+            throw new OMException(e);
+        }
+    }
+
+    /**
+     * Method setCache
+     *
+     * @param b
+     */
+    public void setCache(boolean b) {
+        if (parserAccessed && b) {
+            throw new UnsupportedOperationException(
+                    "parser accessed. cannot set cache");
+        }
+        cache = b;
+    }
+
+    /**
+     * Method getName
+     *
+     * @return
+     * @throws OMException
+     */
+    public String getName() throws OMException {
+        return parser.getLocalName();
+    }
+
+    /**
+     * Method getPrefix
+     *
+     * @return
+     * @throws OMException
+     */
+    public String getPrefix() throws OMException {
+        return parser.getPrefix();
+    }
+
+    /**
+     * Method getAttributeCount
+     *
+     * @return
+     * @throws OMException
+     */
+    public int getAttributeCount() throws OMException {
+        return parser.getAttributeCount();
+    }
+
+    /**
+     * Method getAttributeNamespace
+     *
+     * @param arg
+     * @return
+     * @throws OMException
+     */
+    public String getAttributeNamespace(int arg) throws OMException {
+        return parser.getAttributeNamespace(arg);
+    }
+
+    /**
+     * Method getAttributeName
+     *
+     * @param arg
+     * @return
+     * @throws OMException
+     */
+    public String getAttributeName(int arg) throws OMException {
+        return parser.getAttributeNamespace(arg);
+    }
+
+    /**
+     * Method getAttributePrefix
+     *
+     * @param arg
+     * @return
+     * @throws OMException
+     */
+    public String getAttributePrefix(int arg) throws OMException {
+        return parser.getAttributeNamespace(arg);
+    }
+
+    /**
+     * Method getParser
+     *
+     * @return
+     */
+    public Object getParser() {
+        if (!cache) {
+            parserAccessed = true;
+            return parser;
+        } else {
+            throw new UnsupportedOperationException(
+                    "cache must be switched off to access the parser");
+        }
+    }
+
+    /**
+     * Method isCompleted
+     *
+     * @return
+     */
+    public boolean isCompleted() {
+        return done;
+    }
+
+    /**
+     * This method will be called with the XMLStreamConstants.START_ELEMENT event
+     *
+     * @return
+     * @throws OMException
+     */
+    protected abstract OMNode createOMElement() throws OMException;
+
+    /**
+     * This should proceed the parser one step further, if parser is not completed yet.
+     * If this has been called whist parser is done, then throw an OMException.
+     * If the cache is set to false, then should be return the event, *without* building the OM tree.
+     * If the cache is set to true, then this should handle all the events within this, and should build
+     * the object structure appropriately and return the event.
+     *
+     * @return
+     * @throws OMException
+     */
+    public abstract int next() throws OMException;
+
+    /**
+     * @return
+     */
+    public short getBuilderType() {
+        return OMConstants.PULL_TYPE_BUILDER;
+    }
+
+    /**
+     * Method registerExternalContentHandler
+     *
+     * @param obj
+     */
+    public void registerExternalContentHandler(Object obj) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method getRegisteredContentHandler
+     *
+     * @return
+     */
+    public Object getRegisteredContentHandler() {
+        throw new UnsupportedOperationException();
+    }
+
+    public OMDocument getDocument() {
+        return document;
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java Thu Sep 15 11:52:11 2005
@@ -1,326 +1,326 @@
-/*
-* 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.axis2.om.impl.llom.builder;
-
-import org.apache.axis2.om.*;
-import org.apache.axis2.om.impl.llom.OMDocumentImpl;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-
-/**
- * This will construct an OM without using SOAP specific classes like SOAPEnvelope, SOAPHeader, SOAPHeaderBlock and SOAPBody.
- * And this will habe the Document concept also.
- */
-public class StAXOMBuilder extends StAXBuilder {
-    /**
-     * Field document
-     */
-
-    private boolean doDebug = false;
-
-    /**
-     * Constructor StAXOMBuilder
-     *
-     * @param ombuilderFactory
-     * @param parser
-     */
-    public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
-        super(ombuilderFactory, parser);
-        document = new OMDocumentImpl(this);
-    }
-
-    /**
-     *
-     * @param filePath - Path to the XML file
-     * @throws XMLStreamException
-     * @throws FileNotFoundException
-     */
-    public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException {
-       this(XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(filePath)));
-    }
-
-    /**
-     *
-     * @param inStream - instream which contains the XML
-     * @throws XMLStreamException
-     */
-    public StAXOMBuilder(InputStream inStream) throws XMLStreamException {
-       this(XMLInputFactory.newInstance().createXMLStreamReader(inStream));
-    }
-
-    /**
-     * Constructor StAXOMBuilder
-     *
-     * @param parser
-     */
-    public StAXOMBuilder(XMLStreamReader parser) {
-        super(parser);
-        document = new OMDocumentImpl(this);
-        omfactory = OMAbstractFactory.getOMFactory();
-    }
-
-    /**
-     * Method createOMElement
-     *
-     * @return
-     * @throws OMException
-     */
-    protected OMNode createOMElement() throws OMException {
-        OMElement node;
-        String elementName = parser.getLocalName();
-        if (lastNode == null) {
-            node = omfactory.createOMElement(elementName, null, null, this);
-            document.setDocumentElement(node);
-            document.addChild(node);
-        } else if (lastNode.isComplete()) {
-            node = omfactory.createOMElement(elementName, null,
-                    lastNode.getParent(), this);
-            lastNode.setNextSibling(node);
-            node.setPreviousSibling(lastNode);
-        } else {
-            OMElement e = (OMElement) lastNode;
-            node = omfactory.createOMElement(elementName, null,
-                    (OMElement) lastNode, this);
-            e.setFirstChild(node);
-        }
-        // create the namespaces
-        processNamespaceData(node, false);
-        // fill in the attributes
-        processAttributes(node);
-        return node;
-    }
-
-    /**
-     * Method createOMText
-     *
-     * @return
-     * @throws OMException
-     */
-    protected OMNode createComment() throws OMException {
-        OMNode node;
-        if (lastNode == null) {
-            node = omfactory.createOMComment(document, parser.getText());
-        } else if (lastNode.isComplete()) {
-            node = omfactory.createOMComment(lastNode.getParent(), parser.getText());
-        } else {
-            node = omfactory.createOMComment((OMElement) lastNode, parser.getText());
-        }
-        return node;
-    }
-
-    /**
-     * Method createDTD
-     *
-     * @return
-     * @throws OMException
-     */
-    protected OMNode createDTD() throws OMException {
-        if (!parser.hasText())
-            return null;
-        return omfactory.createOMDocType(document, parser.getText());
-    }
-
-    /**
-     * Method createPI
-     * @return
-     * @throws OMException
-     */
-    protected OMNode createPI() throws OMException {
-        OMNode node;
-        String target = parser.getPITarget();
-        String data = parser.getPIData();
-        if (lastNode == null) {
-            node = omfactory.createOMProcessingInstruction(document, target, data);
-        } else if (lastNode.isComplete()) {
-            node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);
-        } else if (lastNode instanceof OMText) {
-            node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);
-        } else {
-            node = omfactory.createOMProcessingInstruction((OMContainer) lastNode, target, data);
-        }
-        return node;
-    }
-
-    protected void endElement(){
-        if (lastNode.isComplete()) {
-            OMElement parent = (OMElement) lastNode.getParent();
-            parent.setComplete(true);
-            lastNode = parent;
-        } else {
-            OMElement e = (OMElement) lastNode;
-            e.setComplete(true);
-        }
-
-        //return lastNode;
-    }
-
-    /**
-     * Method next
-     *
-     * @return
-     * @throws OMException
-     */
-    public int next() throws OMException {
-        try {
-            if (done) {
-                throw new OMException();
-            }
-            int token = parser.next();
-            if (!cache) {
-                return token;
-            }
-            switch (token) {
-                case XMLStreamConstants.START_ELEMENT:
-                    if(doDebug) {
-                        System.out.println("START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
-                    }
-                    lastNode = createOMElement();
-                    break;
-                case XMLStreamConstants.START_DOCUMENT:
-                    // Document has already being created.
-                    
-                    document.setXMLVersion(parser.getVersion());
-                    document.setCharsetEncoding(parser.getEncoding());
-                    document.setStandalone(parser.isStandalone() ? "yes" : "no");
-                    if(doDebug) {
-                        System.out.println("START_DOCUMENT: ");
-                    }
-                    break;
-                case XMLStreamConstants.CHARACTERS:
-                    if(doDebug) {
-                        System.out.println("CHARACTERS: [" + parser.getText() + "]");
-                    }
-                    lastNode = createOMText(XMLStreamConstants.CHARACTERS);
-                    break;
-                case XMLStreamConstants.CDATA:
-                    if(doDebug) {
-                        System.out.println("CDATA: [" + parser.getText() + "]");
-                    }
-                    lastNode = createOMText(XMLStreamConstants.CDATA);
-                    break;
-                case XMLStreamConstants.END_ELEMENT:
-                    if(doDebug) {
-                        System.out.println("END_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
-                    }
-                    endElement();
-                    break;
-                case XMLStreamConstants.END_DOCUMENT:
-                    if(doDebug) {
-                        System.out.println("END_DOCUMENT: ");
-                    }
-                    done = true;
-                    break;
-                case XMLStreamConstants.SPACE:
-                    if(doDebug) {
-                        System.out.println("SPACE: [" + parser.getText() + "]");
-                    }
-                    lastNode = createOMText(XMLStreamConstants.SPACE);
-                    break;
-                case XMLStreamConstants.COMMENT:
-                    if(doDebug) {
-                        System.out.println("COMMENT: [" + parser.getText() + "]");
-                    }
-                    createComment();
-                    break;
-                case XMLStreamConstants.DTD:
-                    if(doDebug) {
-                        System.out.println("DTD: [" + parser.getText() + "]");
-                    }
-                    createDTD();
-                    break;
-                case XMLStreamConstants.PROCESSING_INSTRUCTION:
-                    if(doDebug) {
-                        System.out.println("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" + parser.getPIData() + "]");
-                    }
-                    createPI();
-                    break;
-                case XMLStreamConstants.ENTITY_REFERENCE:
-                    if(doDebug) {
-                        System.out.println("ENTITY_REFERENCE: " + parser.getLocalName() + "[" + parser.getText() + "]");
-                    }
-                    lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE);
-                    break;
-                default :
-                    throw new OMException();
-            }
-            return token;
-        } catch (OMException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new OMException(e);
-        }
-    }
-
-   /**
-     * Method getDocumentElement
-     *
-     * @return root element
-     */
-    public OMElement getDocumentElement() {
-        return document.getDocumentElement();
-    }
-
-    /**
-     * Method processNamespaceData
-     *
-     * @param node
-     * @param isSOAPElement
-     */
-    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
-        int namespaceCount = parser.getNamespaceCount();
-        for (int i = 0; i < namespaceCount; i++) {
-            node.declareNamespace(parser.getNamespaceURI(i),
-                    parser.getNamespacePrefix(i));
-        }
-        // set the own namespace
-        String namespaceURI = parser.getNamespaceURI();
-        String prefix = parser.getPrefix();
-        OMNamespace namespace = null;
-        if (namespaceURI != null && namespaceURI.length() > 0) {
-            if (prefix == null) {
-                // this means, this elements has a default namespace or it has inherited a default namespace from its parent
-                namespace = node.findNamespace(namespaceURI, "");
-                if (namespace == null) {
-                    namespace = node.declareNamespace(namespaceURI, "");
-                }
-                if (node.getNamespace() == null) {
-                    node.setNamespace(namespace);
-                }
-            } else {
-                namespace = node.findNamespace(namespaceURI, prefix);
-                if (namespace == null) {
-                    node.setNamespace(
-                            omfactory.createOMNamespace(namespaceURI, prefix));
-                } else {
-                    node.setNamespace(namespace);
-                }
-            }
-        }
-    }
-
-    
-
-    public void setDoDebug(boolean doDebug) {
-        this.doDebug = doDebug;
-    }
-}
+/*
+* 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.axis2.om.impl.llom.builder;
+
+import org.apache.axis2.om.*;
+import org.apache.axis2.om.impl.llom.OMDocumentImpl;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+
+/**
+ * This will construct an OM without using SOAP specific classes like SOAPEnvelope, SOAPHeader, SOAPHeaderBlock and SOAPBody.
+ * And this will habe the Document concept also.
+ */
+public class StAXOMBuilder extends StAXBuilder {
+    /**
+     * Field document
+     */
+
+    private boolean doDebug = false;
+
+    /**
+     * Constructor StAXOMBuilder
+     *
+     * @param ombuilderFactory
+     * @param parser
+     */
+    public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
+        super(ombuilderFactory, parser);
+        document = new OMDocumentImpl(this);
+    }
+
+    /**
+     *
+     * @param filePath - Path to the XML file
+     * @throws XMLStreamException
+     * @throws FileNotFoundException
+     */
+    public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException {
+       this(XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(filePath)));
+    }
+
+    /**
+     *
+     * @param inStream - instream which contains the XML
+     * @throws XMLStreamException
+     */
+    public StAXOMBuilder(InputStream inStream) throws XMLStreamException {
+       this(XMLInputFactory.newInstance().createXMLStreamReader(inStream));
+    }
+
+    /**
+     * Constructor StAXOMBuilder
+     *
+     * @param parser
+     */
+    public StAXOMBuilder(XMLStreamReader parser) {
+        super(parser);
+        document = new OMDocumentImpl(this);
+        omfactory = OMAbstractFactory.getOMFactory();
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @return
+     * @throws OMException
+     */
+    protected OMNode createOMElement() throws OMException {
+        OMElement node;
+        String elementName = parser.getLocalName();
+        if (lastNode == null) {
+            node = omfactory.createOMElement(elementName, null, null, this);
+            document.setDocumentElement(node);
+            document.addChild(node);
+        } else if (lastNode.isComplete()) {
+            node = omfactory.createOMElement(elementName, null,
+                    lastNode.getParent(), this);
+            lastNode.setNextSibling(node);
+            node.setPreviousSibling(lastNode);
+        } else {
+            OMElement e = (OMElement) lastNode;
+            node = omfactory.createOMElement(elementName, null,
+                    (OMElement) lastNode, this);
+            e.setFirstChild(node);
+        }
+        // create the namespaces
+        processNamespaceData(node, false);
+        // fill in the attributes
+        processAttributes(node);
+        return node;
+    }
+
+    /**
+     * Method createOMText
+     *
+     * @return
+     * @throws OMException
+     */
+    protected OMNode createComment() throws OMException {
+        OMNode node;
+        if (lastNode == null) {
+            node = omfactory.createOMComment(document, parser.getText());
+        } else if (lastNode.isComplete()) {
+            node = omfactory.createOMComment(lastNode.getParent(), parser.getText());
+        } else {
+            node = omfactory.createOMComment((OMElement) lastNode, parser.getText());
+        }
+        return node;
+    }
+
+    /**
+     * Method createDTD
+     *
+     * @return
+     * @throws OMException
+     */
+    protected OMNode createDTD() throws OMException {
+        if (!parser.hasText())
+            return null;
+        return omfactory.createOMDocType(document, parser.getText());
+    }
+
+    /**
+     * Method createPI
+     * @return
+     * @throws OMException
+     */
+    protected OMNode createPI() throws OMException {
+        OMNode node;
+        String target = parser.getPITarget();
+        String data = parser.getPIData();
+        if (lastNode == null) {
+            node = omfactory.createOMProcessingInstruction(document, target, data);
+        } else if (lastNode.isComplete()) {
+            node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);
+        } else if (lastNode instanceof OMText) {
+            node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);
+        } else {
+            node = omfactory.createOMProcessingInstruction((OMContainer) lastNode, target, data);
+        }
+        return node;
+    }
+
+    protected void endElement(){
+        if (lastNode.isComplete()) {
+            OMElement parent = (OMElement) lastNode.getParent();
+            parent.setComplete(true);
+            lastNode = parent;
+        } else {
+            OMElement e = (OMElement) lastNode;
+            e.setComplete(true);
+        }
+
+        //return lastNode;
+    }
+
+    /**
+     * Method next
+     *
+     * @return
+     * @throws OMException
+     */
+    public int next() throws OMException {
+        try {
+            if (done) {
+                throw new OMException();
+            }
+            int token = parser.next();
+            if (!cache) {
+                return token;
+            }
+            switch (token) {
+                case XMLStreamConstants.START_ELEMENT:
+                    if(doDebug) {
+                        System.out.println("START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
+                    }
+                    lastNode = createOMElement();
+                    break;
+                case XMLStreamConstants.START_DOCUMENT:
+                    // Document has already being created.
+                    
+                    document.setXMLVersion(parser.getVersion());
+                    document.setCharsetEncoding(parser.getEncoding());
+                    document.setStandalone(parser.isStandalone() ? "yes" : "no");
+                    if(doDebug) {
+                        System.out.println("START_DOCUMENT: ");
+                    }
+                    break;
+                case XMLStreamConstants.CHARACTERS:
+                    if(doDebug) {
+                        System.out.println("CHARACTERS: [" + parser.getText() + "]");
+                    }
+                    lastNode = createOMText(XMLStreamConstants.CHARACTERS);
+                    break;
+                case XMLStreamConstants.CDATA:
+                    if(doDebug) {
+                        System.out.println("CDATA: [" + parser.getText() + "]");
+                    }
+                    lastNode = createOMText(XMLStreamConstants.CDATA);
+                    break;
+                case XMLStreamConstants.END_ELEMENT:
+                    if(doDebug) {
+                        System.out.println("END_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
+                    }
+                    endElement();
+                    break;
+                case XMLStreamConstants.END_DOCUMENT:
+                    if(doDebug) {
+                        System.out.println("END_DOCUMENT: ");
+                    }
+                    done = true;
+                    break;
+                case XMLStreamConstants.SPACE:
+                    if(doDebug) {
+                        System.out.println("SPACE: [" + parser.getText() + "]");
+                    }
+                    lastNode = createOMText(XMLStreamConstants.SPACE);
+                    break;
+                case XMLStreamConstants.COMMENT:
+                    if(doDebug) {
+                        System.out.println("COMMENT: [" + parser.getText() + "]");
+                    }
+                    createComment();
+                    break;
+                case XMLStreamConstants.DTD:
+                    if(doDebug) {
+                        System.out.println("DTD: [" + parser.getText() + "]");
+                    }
+                    createDTD();
+                    break;
+                case XMLStreamConstants.PROCESSING_INSTRUCTION:
+                    if(doDebug) {
+                        System.out.println("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" + parser.getPIData() + "]");
+                    }
+                    createPI();
+                    break;
+                case XMLStreamConstants.ENTITY_REFERENCE:
+                    if(doDebug) {
+                        System.out.println("ENTITY_REFERENCE: " + parser.getLocalName() + "[" + parser.getText() + "]");
+                    }
+                    lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE);
+                    break;
+                default :
+                    throw new OMException();
+            }
+            return token;
+        } catch (OMException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new OMException(e);
+        }
+    }
+
+   /**
+     * Method getDocumentElement
+     *
+     * @return root element
+     */
+    public OMElement getDocumentElement() {
+        return document.getDocumentElement();
+    }
+
+    /**
+     * Method processNamespaceData
+     *
+     * @param node
+     * @param isSOAPElement
+     */
+    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
+        int namespaceCount = parser.getNamespaceCount();
+        for (int i = 0; i < namespaceCount; i++) {
+            node.declareNamespace(parser.getNamespaceURI(i),
+                    parser.getNamespacePrefix(i));
+        }
+        // set the own namespace
+        String namespaceURI = parser.getNamespaceURI();
+        String prefix = parser.getPrefix();
+        OMNamespace namespace = null;
+        if (namespaceURI != null && namespaceURI.length() > 0) {
+            if (prefix == null) {
+                // this means, this elements has a default namespace or it has inherited a default namespace from its parent
+                namespace = node.findNamespace(namespaceURI, "");
+                if (namespace == null) {
+                    namespace = node.declareNamespace(namespaceURI, "");
+                }
+                if (node.getNamespace() == null) {
+                    node.setNamespace(namespace);
+                }
+            } else {
+                namespace = node.findNamespace(namespaceURI, prefix);
+                if (namespace == null) {
+                    node.setNamespace(
+                            omfactory.createOMNamespace(namespaceURI, prefix));
+                } else {
+                    node.setNamespace(namespace);
+                }
+            }
+        }
+    }
+
+    
+
+    public void setDoDebug(boolean doDebug) {
+        this.doDebug = doDebug;
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXOMBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMBuilderException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMBuilderException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMBuilderException.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMBuilderException.java Thu Sep 15 11:52:11 2005
@@ -1,36 +1,36 @@
-/*
- * 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.axis2.om.impl.llom.exception;
-
-import org.apache.axis2.om.OMException;
-
-/**
- * Class OMBuilderException
- */
-public class OMBuilderException extends OMException {
-    /**
-     * Constructor OMBuilderException
-     *
-     * @param s
-     */
-    public OMBuilderException(String s) {
-        super(s);
-    }
-
-    public OMBuilderException(Throwable cause) {
-        super(cause);    //To change body of overridden methods use File | Settings | File Templates.
-    }
-}
+/*
+ * 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.axis2.om.impl.llom.exception;
+
+import org.apache.axis2.om.OMException;
+
+/**
+ * Class OMBuilderException
+ */
+public class OMBuilderException extends OMException {
+    /**
+     * Constructor OMBuilderException
+     *
+     * @param s
+     */
+    public OMBuilderException(String s) {
+        super(s);
+    }
+
+    public OMBuilderException(Throwable cause) {
+        super(cause);    //To change body of overridden methods use File | Settings | File Templates.
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMBuilderException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMStreamingException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMStreamingException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMStreamingException.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMStreamingException.java Thu Sep 15 11:52:11 2005
@@ -1,57 +1,57 @@
-/*
- * 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.axis2.om.impl.llom.exception;
-
-import org.apache.axis2.om.OMException;
-
-/**
- * Class OMStreamingException
- */
-public class OMStreamingException extends OMException {
-    /**
-     * Constructor OMStreamingException
-     */
-    public OMStreamingException() {
-    }
-
-    /**
-     * Constructor OMStreamingException
-     *
-     * @param message
-     */
-    public OMStreamingException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructor OMStreamingException
-     *
-     * @param message
-     * @param cause
-     */
-    public OMStreamingException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Constructor OMStreamingException
-     *
-     * @param cause
-     */
-    public OMStreamingException(Throwable cause) {
-        super(cause);
-    }
-}
+/*
+ * 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.axis2.om.impl.llom.exception;
+
+import org.apache.axis2.om.OMException;
+
+/**
+ * Class OMStreamingException
+ */
+public class OMStreamingException extends OMException {
+    /**
+     * Constructor OMStreamingException
+     */
+    public OMStreamingException() {
+    }
+
+    /**
+     * Constructor OMStreamingException
+     *
+     * @param message
+     */
+    public OMStreamingException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructor OMStreamingException
+     *
+     * @param message
+     * @param cause
+     */
+    public OMStreamingException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructor OMStreamingException
+     *
+     * @param cause
+     */
+    public OMStreamingException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/OMStreamingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/XMLComparisonException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/XMLComparisonException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/XMLComparisonException.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/XMLComparisonException.java Thu Sep 15 11:52:11 2005
@@ -1,35 +1,35 @@
-package org.apache.axis2.om.impl.llom.exception;
-
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-public class XMLComparisonException extends Exception {
-    /**
-     * Eran Chinthaka (chinthaka@apache.org)
-     */
-
-    public XMLComparisonException(String message) {
-        super(message);
-    }
-
-    public XMLComparisonException(Throwable cause) {
-        super(cause);
-    }
-
-    public XMLComparisonException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
+package org.apache.axis2.om.impl.llom.exception;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+public class XMLComparisonException extends Exception {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    public XMLComparisonException(String message) {
+        super(message);
+    }
+
+    public XMLComparisonException(Throwable cause) {
+        super(cause);
+    }
+
+    public XMLComparisonException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/exception/XMLComparisonException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java Thu Sep 15 11:52:11 2005
@@ -1,214 +1,214 @@
-/*
- * 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.axis2.om.impl.llom.factory;
-
-import org.apache.axis2.om.*;
-import org.apache.axis2.om.impl.llom.*;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-
-/**
- * Class OMLinkedListImplFactory
- */
-public class OMLinkedListImplFactory implements OMFactory {
-    /**
-     * Field MAX_TO_POOL
-     */
-    public static final int MAX_TO_POOL = 100;
-
-    /**
-     * Method createOMElement
-     *
-     * @param localName
-     * @param ns
-     * @return element
-     */
-    public OMElement createOMElement(String localName, OMNamespace ns) {
-        return new OMElementImpl(localName, ns);
-    }
-
-    public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) {
-        return new OMElementImpl(localName, ns, parent);
-    }
-
-    /**
-     * Method createOMElement
-     *
-     * @param localName
-     * @param ns
-     * @param parent
-     * @param builder
-     * @return element
-     */
-    public OMElement createOMElement(String localName, OMNamespace ns,
-                                     OMContainer parent,
-                                     OMXMLParserWrapper builder) {
-        return new OMElementImpl(localName, ns, parent,
-                builder);
-    }
-
-    /**
-     * Method createOMElement
-     *
-     * @param localName
-     * @param namespaceURI
-     * @param namespacePrefix
-     * @return element
-     */
-    public OMElement createOMElement(String localName, String namespaceURI,
-                                     String namespacePrefix) {
-        return this.createOMElement(localName,
-                this.createOMNamespace(namespaceURI,
-                        namespacePrefix));
-    }
-
-    /**
-     * Method createOMElement
-     *
-     * @param qname
-     * @param parent
-     * @return
-     * @throws OMException
-     */
-    public OMElement createOMElement(QName qname, OMContainer parent)
-            throws OMException {
-        return new OMElementImpl(qname, parent);
-    }
-
-    /**
-     * Method createOMNamespace
-     *
-     * @param uri
-     * @param prefix
-     * @return namespace
-     */
-    public OMNamespace createOMNamespace(String uri, String prefix) {
-        return new OMNamespaceImpl(uri, prefix);
-    }
-
-    /**
-     * Method createText
-     *
-     * @param parent
-     * @param text
-     * @return text
-     */
-    public OMText createText(OMElement parent, String text) {
-        return new OMTextImpl(parent, text);
-    }
-
-    /**
-     * Method createText
-     *
-     * @param s
-     * @return text
-     */
-    public OMText createText(String s) {
-        return new OMTextImpl(s);
-    }
-
-    public OMText createText(String s, int type) {
-        return new OMTextImpl(s, type);
-    }
-
-    /**
-     * create Text
-     * @param s
-     * @param mimeType
-     * @param optimize
-     * @return text
-     */
-    public OMText createText(String s, String mimeType, boolean optimize) {
-        return new OMTextImpl(s, mimeType, optimize);
-    }
-
-    /**
-     * create text
-     * @param dataHandler
-     * @param optimize
-     * @return text
-     */
-    public OMText createText(DataHandler dataHandler, boolean optimize) {
-        return new OMTextImpl(dataHandler, optimize);
-    }
-
-    /**
-     * create text
-     * @param parent
-     * @param s
-     * @param mimeType
-     * @param optimize
-     * @return text
-     */
-    public OMText createText(OMElement parent,
-                             String s,
-                             String mimeType,
-                             boolean optimize) {
-        return new OMTextImpl(parent, s, mimeType, optimize);
-    }
-
-    /**
-     * create attribute
-     * @param localName
-     * @param ns
-     * @param value
-     * @return attribute
-     */
-    public OMAttribute createOMAttribute(String localName,
-                                         OMNamespace ns,
-                                         String value) {
-        return new OMAttributeImpl(localName, ns, value);
-    }
-
-    /**
-     * create DocType/DTD
-     * @param parent
-     * @param content
-     * @return doctype
-     */
-    public OMDocType createOMDocType(OMContainer parent, String content) {
-        return new OMDocTypeImpl(parent, content);
-    }
-
-    /**
-     * create a PI
-     * @param parent
-     * @param piTarget
-     * @param piData
-     * @return pi
-     */
-    public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData) {
-        return new OMProcessingInstructionImpl(parent, piTarget, piData);
-    }
-
-    /**
-     * create a comment
-     * @param parent
-     * @param content
-     * @return comment
-     */
-    public OMComment createOMComment(OMContainer parent, String content) {
-        return new OMCommentImpl(parent, content);
-    }
-
-    /* (non-Javadoc)
-    * @see org.apache.axis2.om.OMFactory#createOMDocument()
-    */
-	public OMDocument createOMDocument() {
-		return new OMDocumentImpl();
-	}
-}
+/*
+ * 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.axis2.om.impl.llom.factory;
+
+import org.apache.axis2.om.*;
+import org.apache.axis2.om.impl.llom.*;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+
+/**
+ * Class OMLinkedListImplFactory
+ */
+public class OMLinkedListImplFactory implements OMFactory {
+    /**
+     * Field MAX_TO_POOL
+     */
+    public static final int MAX_TO_POOL = 100;
+
+    /**
+     * Method createOMElement
+     *
+     * @param localName
+     * @param ns
+     * @return element
+     */
+    public OMElement createOMElement(String localName, OMNamespace ns) {
+        return new OMElementImpl(localName, ns);
+    }
+
+    public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) {
+        return new OMElementImpl(localName, ns, parent);
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     * @return element
+     */
+    public OMElement createOMElement(String localName, OMNamespace ns,
+                                     OMContainer parent,
+                                     OMXMLParserWrapper builder) {
+        return new OMElementImpl(localName, ns, parent,
+                builder);
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @param localName
+     * @param namespaceURI
+     * @param namespacePrefix
+     * @return element
+     */
+    public OMElement createOMElement(String localName, String namespaceURI,
+                                     String namespacePrefix) {
+        return this.createOMElement(localName,
+                this.createOMNamespace(namespaceURI,
+                        namespacePrefix));
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @param qname
+     * @param parent
+     * @return
+     * @throws OMException
+     */
+    public OMElement createOMElement(QName qname, OMContainer parent)
+            throws OMException {
+        return new OMElementImpl(qname, parent);
+    }
+
+    /**
+     * Method createOMNamespace
+     *
+     * @param uri
+     * @param prefix
+     * @return namespace
+     */
+    public OMNamespace createOMNamespace(String uri, String prefix) {
+        return new OMNamespaceImpl(uri, prefix);
+    }
+
+    /**
+     * Method createText
+     *
+     * @param parent
+     * @param text
+     * @return text
+     */
+    public OMText createText(OMElement parent, String text) {
+        return new OMTextImpl(parent, text);
+    }
+
+    /**
+     * Method createText
+     *
+     * @param s
+     * @return text
+     */
+    public OMText createText(String s) {
+        return new OMTextImpl(s);
+    }
+
+    public OMText createText(String s, int type) {
+        return new OMTextImpl(s, type);
+    }
+
+    /**
+     * create Text
+     * @param s
+     * @param mimeType
+     * @param optimize
+     * @return text
+     */
+    public OMText createText(String s, String mimeType, boolean optimize) {
+        return new OMTextImpl(s, mimeType, optimize);
+    }
+
+    /**
+     * create text
+     * @param dataHandler
+     * @param optimize
+     * @return text
+     */
+    public OMText createText(DataHandler dataHandler, boolean optimize) {
+        return new OMTextImpl(dataHandler, optimize);
+    }
+
+    /**
+     * create text
+     * @param parent
+     * @param s
+     * @param mimeType
+     * @param optimize
+     * @return text
+     */
+    public OMText createText(OMElement parent,
+                             String s,
+                             String mimeType,
+                             boolean optimize) {
+        return new OMTextImpl(parent, s, mimeType, optimize);
+    }
+
+    /**
+     * create attribute
+     * @param localName
+     * @param ns
+     * @param value
+     * @return attribute
+     */
+    public OMAttribute createOMAttribute(String localName,
+                                         OMNamespace ns,
+                                         String value) {
+        return new OMAttributeImpl(localName, ns, value);
+    }
+
+    /**
+     * create DocType/DTD
+     * @param parent
+     * @param content
+     * @return doctype
+     */
+    public OMDocType createOMDocType(OMContainer parent, String content) {
+        return new OMDocTypeImpl(parent, content);
+    }
+
+    /**
+     * create a PI
+     * @param parent
+     * @param piTarget
+     * @param piData
+     * @return pi
+     */
+    public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData) {
+        return new OMProcessingInstructionImpl(parent, piTarget, piData);
+    }
+
+    /**
+     * create a comment
+     * @param parent
+     * @param content
+     * @return comment
+     */
+    public OMComment createOMComment(OMContainer parent, String content) {
+        return new OMCommentImpl(parent, content);
+    }
+
+    /* (non-Javadoc)
+    * @see org.apache.axis2.om.OMFactory#createOMDocument()
+    */
+	public OMDocument createOMDocument() {
+		return new OMDocumentImpl();
+	}
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMXMLBuilderFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMXMLBuilderFactory.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMXMLBuilderFactory.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMXMLBuilderFactory.java Thu Sep 15 11:52:11 2005
@@ -1,72 +1,72 @@
-/*
- * 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.axis2.om.impl.llom.factory;
-
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * Class OMXMLBuilderFactory
- */
-public class OMXMLBuilderFactory {
-    /**
-     * Field PARSER_XPP
-     */
-    public static final String PARSER_XPP = "XPP";
-
-    /**
-     * Field PARSER_STAX
-     */
-    public static final String PARSER_STAX = "StAX";
-
-    /**
-     * Field MODEL_SOAP_SPECIFIC
-     */
-    public static final String MODEL_SOAP_SPECIFIC = "SOAP_SPECIFIC";
-
-    /**
-     * Field MODEL_OM
-     */
-    public static final String MODEL_OM = "OM_ONLY";
-
-    /**
-     * Method createStAXSOAPModelBuilder
-     *
-     * @param soapFactory
-     * @param parser
-     * @return
-     */
-    public static StAXSOAPModelBuilder createStAXSOAPModelBuilder(
-            SOAPFactory soapFactory, XMLStreamReader parser) {
-        return new StAXSOAPModelBuilder(parser, soapFactory, null);
-    }
-
-    /**
-     * Method createStAXOMBuilder
-     *
-     * @param ombuilderFactory
-     * @param parser
-     * @return
-     */
-    public static StAXOMBuilder createStAXOMBuilder(OMFactory ombuilderFactory,
-                                                    XMLStreamReader parser) {
-        return new StAXOMBuilder(ombuilderFactory, parser);
-    }
-}
+/*
+ * 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.axis2.om.impl.llom.factory;
+
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Class OMXMLBuilderFactory
+ */
+public class OMXMLBuilderFactory {
+    /**
+     * Field PARSER_XPP
+     */
+    public static final String PARSER_XPP = "XPP";
+
+    /**
+     * Field PARSER_STAX
+     */
+    public static final String PARSER_STAX = "StAX";
+
+    /**
+     * Field MODEL_SOAP_SPECIFIC
+     */
+    public static final String MODEL_SOAP_SPECIFIC = "SOAP_SPECIFIC";
+
+    /**
+     * Field MODEL_OM
+     */
+    public static final String MODEL_OM = "OM_ONLY";
+
+    /**
+     * Method createStAXSOAPModelBuilder
+     *
+     * @param soapFactory
+     * @param parser
+     * @return
+     */
+    public static StAXSOAPModelBuilder createStAXSOAPModelBuilder(
+            SOAPFactory soapFactory, XMLStreamReader parser) {
+        return new StAXSOAPModelBuilder(parser, soapFactory, null);
+    }
+
+    /**
+     * Method createStAXOMBuilder
+     *
+     * @param ombuilderFactory
+     * @param parser
+     * @return
+     */
+    public static StAXOMBuilder createStAXOMBuilder(OMFactory ombuilderFactory,
+                                                    XMLStreamReader parser) {
+        return new StAXOMBuilder(ombuilderFactory, parser);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMXMLBuilderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java Thu Sep 15 11:52:11 2005
@@ -1,151 +1,151 @@
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-package org.apache.axis2.om.impl.llom.mtom;
-
-import org.apache.axis2.attachments.MIMEHelper;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMException;
-import org.apache.axis2.om.OMNode;
-import org.apache.axis2.om.OMText;
-import org.apache.axis2.om.impl.MTOMConstants;
-import org.apache.axis2.om.impl.llom.OMTextImpl;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
-public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder implements MTOMConstants {
-
-    /**
-     * <code>mimeHelper</code> handles deffered parsing of incoming MIME
-     * Messages
-     */
-    MIMEHelper mimeHelper;
-
-    int partIndex = 0;
-
-    public MTOMStAXSOAPModelBuilder(XMLStreamReader parser,
-                                    SOAPFactory factory,
-                                    MIMEHelper mimeHelper, String soapVersion) {
-        super(parser, factory, soapVersion);
-        this.mimeHelper = mimeHelper;
-    }
-
-    /**
-     * @param reader
-     * @param mimeHelper
-     */
-    public MTOMStAXSOAPModelBuilder(XMLStreamReader reader,
-                                    MIMEHelper mimeHelper, String soapVersion) {
-        super(reader, soapVersion);
-        this.mimeHelper = mimeHelper;
-    }
-
-    protected OMNode createOMElement() throws OMException {
-
-        elementLevel++;
-        String elementName = parser.getLocalName();
-
-        String namespaceURI = parser.getNamespaceURI();
-
-        // create an OMBlob if the element is an <xop:Include>
-
-        if (XOP_INCLUDE.equalsIgnoreCase(elementName)
-                && XOP_NAMESPACE_URI
-                .equalsIgnoreCase(namespaceURI)) {
-            // do we need to check prfix as well. Meaning, should it be "XOP" ?
-
-
-            OMText node;
-            String contentID = null;
-            String contentIDName = null;
-            if (lastNode == null) {
-                // Decide whether to ckeck the level >3 or not
-                throw new OMException(
-                        "XOP:Include element is not supported here");
-            }
-            if (parser.getAttributeCount() > 0) {
-                contentID = parser.getAttributeValue(0);
-                contentID = contentID.trim();
-                contentIDName = parser.getAttributeLocalName(0);
-                if (contentIDName.equalsIgnoreCase("href")
-                        & contentID.substring(0, 3).equalsIgnoreCase("cid")) {
-                    contentID = contentID.substring(4);
-                    String charsetEncoding = getDocument().getCharsetEncoding();
-                    String charEnc = charsetEncoding == null || "".equals(charsetEncoding) ? "UTF-8" : charsetEncoding;
-                    try {
-                        contentID = URLDecoder.decode(contentID, charEnc);
-                    } catch (UnsupportedEncodingException e) {
-                        throw new OMException("Unsupported Character Encoding Found", e);
-                    }
-                } else if (!(contentIDName.equalsIgnoreCase("href")
-                        & (!contentID.equals("")))) {
-                    throw new OMException(
-                            "contentID not Found in XOP:Include element");
-                }
-            } else {
-                throw new OMException(
-                        "Href attribute not found in XOP:Include element");
-            }
-
-            // This cannot happen. XOP:Include is always the only child of an parent element
-            // cause it is same as having some text
-            try {
-                OMElement e = (OMElement) lastNode;
-                node = new OMTextImpl(contentID, (OMElement) lastNode, this);
-                e.setFirstChild(node);
-            } catch (ClassCastException e) {
-                throw new OMException(
-                        "Last Node & Parent of an OMText should be an Element" +
-                                e);
-            }
-
-            return node;
-
-        } else {
-            OMElement node;
-            if (lastNode == null) {
-                node = constructNode(null, elementName, true);
-            } else if (lastNode.isComplete()) {
-                node =
-                        constructNode((OMElement) lastNode.getParent(),
-                                elementName,
-                                false);
-                lastNode.setNextSibling(node);
-                node.setPreviousSibling(lastNode);
-            } else {
-                OMElement e = (OMElement) lastNode;
-                node = constructNode((OMElement) lastNode, elementName, false);
-                e.setFirstChild(node);
-            }
-
-            // fill in the attributes
-            processAttributes(node);
-            //TODO Exception when trying to log . check this
-            //			log.info("Build the OMElelment {" + node.getLocalName() + '}'
-            //					+ node.getLocalName() + "By the StaxSOAPModelBuilder");
-            return node;
-        }
-    }
-
-    public DataHandler getDataHandler(String blobContentID) throws OMException {
-        return mimeHelper.getDataHandler(blobContentID);
-    }
-}
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+package org.apache.axis2.om.impl.llom.mtom;
+
+import org.apache.axis2.attachments.MIMEHelper;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.impl.MTOMConstants;
+import org.apache.axis2.om.impl.llom.OMTextImpl;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder implements MTOMConstants {
+
+    /**
+     * <code>mimeHelper</code> handles deffered parsing of incoming MIME
+     * Messages
+     */
+    MIMEHelper mimeHelper;
+
+    int partIndex = 0;
+
+    public MTOMStAXSOAPModelBuilder(XMLStreamReader parser,
+                                    SOAPFactory factory,
+                                    MIMEHelper mimeHelper, String soapVersion) {
+        super(parser, factory, soapVersion);
+        this.mimeHelper = mimeHelper;
+    }
+
+    /**
+     * @param reader
+     * @param mimeHelper
+     */
+    public MTOMStAXSOAPModelBuilder(XMLStreamReader reader,
+                                    MIMEHelper mimeHelper, String soapVersion) {
+        super(reader, soapVersion);
+        this.mimeHelper = mimeHelper;
+    }
+
+    protected OMNode createOMElement() throws OMException {
+
+        elementLevel++;
+        String elementName = parser.getLocalName();
+
+        String namespaceURI = parser.getNamespaceURI();
+
+        // create an OMBlob if the element is an <xop:Include>
+
+        if (XOP_INCLUDE.equalsIgnoreCase(elementName)
+                && XOP_NAMESPACE_URI
+                .equalsIgnoreCase(namespaceURI)) {
+            // do we need to check prfix as well. Meaning, should it be "XOP" ?
+
+
+            OMText node;
+            String contentID = null;
+            String contentIDName = null;
+            if (lastNode == null) {
+                // Decide whether to ckeck the level >3 or not
+                throw new OMException(
+                        "XOP:Include element is not supported here");
+            }
+            if (parser.getAttributeCount() > 0) {
+                contentID = parser.getAttributeValue(0);
+                contentID = contentID.trim();
+                contentIDName = parser.getAttributeLocalName(0);
+                if (contentIDName.equalsIgnoreCase("href")
+                        & contentID.substring(0, 3).equalsIgnoreCase("cid")) {
+                    contentID = contentID.substring(4);
+                    String charsetEncoding = getDocument().getCharsetEncoding();
+                    String charEnc = charsetEncoding == null || "".equals(charsetEncoding) ? "UTF-8" : charsetEncoding;
+                    try {
+                        contentID = URLDecoder.decode(contentID, charEnc);
+                    } catch (UnsupportedEncodingException e) {
+                        throw new OMException("Unsupported Character Encoding Found", e);
+                    }
+                } else if (!(contentIDName.equalsIgnoreCase("href")
+                        & (!contentID.equals("")))) {
+                    throw new OMException(
+                            "contentID not Found in XOP:Include element");
+                }
+            } else {
+                throw new OMException(
+                        "Href attribute not found in XOP:Include element");
+            }
+
+            // This cannot happen. XOP:Include is always the only child of an parent element
+            // cause it is same as having some text
+            try {
+                OMElement e = (OMElement) lastNode;
+                node = new OMTextImpl(contentID, (OMElement) lastNode, this);
+                e.setFirstChild(node);
+            } catch (ClassCastException e) {
+                throw new OMException(
+                        "Last Node & Parent of an OMText should be an Element" +
+                                e);
+            }
+
+            return node;
+
+        } else {
+            OMElement node;
+            if (lastNode == null) {
+                node = constructNode(null, elementName, true);
+            } else if (lastNode.isComplete()) {
+                node =
+                        constructNode((OMElement) lastNode.getParent(),
+                                elementName,
+                                false);
+                lastNode.setNextSibling(node);
+                node.setPreviousSibling(lastNode);
+            } else {
+                OMElement e = (OMElement) lastNode;
+                node = constructNode((OMElement) lastNode, elementName, false);
+                e.setFirstChild(node);
+            }
+
+            // fill in the attributes
+            processAttributes(node);
+            //TODO Exception when trying to log . check this
+            //			log.info("Build the OMElelment {" + node.getLocalName() + '}'
+            //					+ node.getLocalName() + "By the StaxSOAPModelBuilder");
+            return node;
+        }
+    }
+
+    public DataHandler getDataHandler(String blobContentID) throws OMException {
+        return mimeHelper.getDataHandler(blobContentID);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/serialize/StreamingOMSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native