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 di...@apache.org on 2006/04/05 03:10:40 UTC

svn commit: r391462 [1/2] - in /webservices/commons/trunk/modules/axiom/src/org/apache/axiom: om/impl/ om/impl/dom/ om/impl/llom/ soap/impl/dom/ soap/impl/dom/soap11/ soap/impl/llom/ soap/impl/llom/soap11/

Author: dims
Date: Tue Apr  4 18:10:36 2006
New Revision: 391462

URL: http://svn.apache.org/viewcvs?rev=391462&view=rev
Log:
convert OMOutputImpl into a Filter for XMLStreamWriter and rename the class to MTOMXMLStreamWriter

Added:
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
Removed:
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/OMOutputImpl.java
Modified:
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/OMNodeEx.java
    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/CommentImpl.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/NodeImpl.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/llom/OMCommentImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.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/SOAPMessageImpl.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/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/llom/SOAPEnvelopeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/SOAPFaultDetailImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/SOAPFaultNodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/SOAPFaultRoleImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=391462&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Tue Apr  4 18:10:36 2006
@@ -0,0 +1,299 @@
+/*
+ * 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;
+
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedList;
+
+
+/**
+ * For the moment this assumes that transport takes the decision of whether
+ * to optimize or not by looking at whether the MTOM optimize is enabled &
+ * also looking at the OM tree whether it has any optimizable content.
+ */
+public class MTOMXMLStreamWriter implements XMLStreamWriter {
+    private static XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+    private XMLStreamWriter xmlWriter;
+    private OutputStream outStream;
+    private LinkedList binaryNodeList = new LinkedList();
+    private StringWriter bufferedSOAPBody;
+    private OMOutputFormat format = new OMOutputFormat();
+
+    public MTOMXMLStreamWriter(XMLStreamWriter xmlWriter) {
+        this.xmlWriter = xmlWriter;
+    }
+
+    /**
+     * Creates a new MTOMXMLStreamWriter with specified encoding.
+     *
+     * @param outStream
+     * @param format
+     * @throws XMLStreamException
+     * @throws FactoryConfigurationError
+     * @see OMOutputFormat#DEFAULT_CHAR_SET_ENCODING
+     */
+    public MTOMXMLStreamWriter(OutputStream outStream, OMOutputFormat format)
+            throws XMLStreamException, FactoryConfigurationError {
+        this.format = format;
+        this.outStream = outStream;
+
+        if (format.getCharSetEncoding() == null) //Default encoding is UTF-8
+            format.setCharSetEncoding(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
+
+        if (format.isOptimized()) {
+            bufferedSOAPBody = new StringWriter();
+            xmlWriter = outputFactory.createXMLStreamWriter(bufferedSOAPBody);
+        } else {
+            try {
+                xmlWriter = outputFactory.createXMLStreamWriter(new java.io.BufferedWriter(new OutputStreamWriter(outStream,
+                        format.getCharSetEncoding())));
+            } catch (UnsupportedEncodingException e) {
+                throw new XMLStreamException(e);
+            }
+        }
+    }
+
+    public void writeStartElement(String string) throws XMLStreamException {
+        xmlWriter.writeStartElement(string);
+    }
+
+    public void writeStartElement(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1);
+    }
+
+    public void writeStartElement(String string, String string1, String string2) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1, string2);
+    }
+
+    public void writeEmptyElement(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1);
+    }
+
+    public void writeEmptyElement(String string, String string1, String string2) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1, string2);
+    }
+
+    public void writeEmptyElement(String string) throws XMLStreamException {
+        xmlWriter.writeStartElement(string);
+    }
+
+    public void writeEndElement() throws XMLStreamException {
+        xmlWriter.writeEndElement();
+    }
+
+    public void writeEndDocument() throws XMLStreamException {
+        xmlWriter.writeEndDocument();
+    }
+
+    public void close() throws XMLStreamException {
+        xmlWriter.close();
+    }
+
+    public void flush() throws XMLStreamException {
+        xmlWriter.flush();
+        String SOAPContentType;
+        if (format.isOptimized()) {
+            if (format.isSOAP11()) {
+                SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+            } else {
+                SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+            }
+            MIMEOutputUtils.complete(
+                    outStream,
+                    bufferedSOAPBody,
+                    binaryNodeList,
+                    format.getMimeBoundary(),
+                    format.getRootContentId(),
+                    format.getCharSetEncoding(), SOAPContentType);
+        }
+    }
+
+    public void writeAttribute(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeAttribute(string, string1);
+    }
+
+    public void writeAttribute(String string, String string1, String string2, String string3) throws XMLStreamException {
+        xmlWriter.writeAttribute(string, string1, string2, string3);
+    }
+
+    public void writeAttribute(String string, String string1, String string2) throws XMLStreamException {
+        xmlWriter.writeAttribute(string, string1, string2);
+    }
+
+    public void writeNamespace(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeNamespace(string, string1);
+    }
+
+    public void writeDefaultNamespace(String string) throws XMLStreamException {
+        xmlWriter.writeDefaultNamespace(string);
+    }
+
+    public void writeComment(String string) throws XMLStreamException {
+        xmlWriter.writeComment(string);
+    }
+
+    public void writeProcessingInstruction(String string) throws XMLStreamException {
+        xmlWriter.writeProcessingInstruction(string);
+    }
+
+    public void writeProcessingInstruction(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeProcessingInstruction(string, string1);
+    }
+
+    public void writeCData(String string) throws XMLStreamException {
+        xmlWriter.writeCData(string);
+    }
+
+    public void writeDTD(String string) throws XMLStreamException {
+        xmlWriter.writeDTD(string);
+    }
+
+    public void writeEntityRef(String string) throws XMLStreamException {
+        xmlWriter.writeEntityRef(string);
+    }
+
+    public void writeStartDocument() throws XMLStreamException {
+        xmlWriter.writeStartDocument();
+    }
+
+    public void writeStartDocument(String string) throws XMLStreamException {
+        xmlWriter.writeStartDocument(string);
+    }
+
+    public void writeStartDocument(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeStartDocument(string, string1);
+    }
+
+    public void writeCharacters(String string) throws XMLStreamException {
+        xmlWriter.writeCharacters(string);
+    }
+
+    public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException {
+        xmlWriter.writeCharacters(chars, i, i1);
+    }
+
+    public String getPrefix(String string) throws XMLStreamException {
+        return xmlWriter.getPrefix(string);
+    }
+
+    public void setPrefix(String string, String string1) throws XMLStreamException {
+        xmlWriter.setPrefix(string, string1);
+    }
+
+    public void setDefaultNamespace(String string) throws XMLStreamException {
+        xmlWriter.setDefaultNamespace(string);
+    }
+
+    public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException {
+        xmlWriter.setNamespaceContext(namespaceContext);
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        return xmlWriter.getNamespaceContext();
+    }
+
+    public Object getProperty(String string) throws IllegalArgumentException {
+        return xmlWriter.getProperty(string);
+    }
+
+    public boolean isOptimized() {
+        return format.isOptimized();
+    }
+
+    public String getContentType() {
+        return format.getContentType();
+    }
+
+    public void writeOptimized(OMText node) {
+        binaryNodeList.add(node);
+    }
+
+    public void setXmlStreamWriter(XMLStreamWriter xmlWriter) {
+        this.xmlWriter = xmlWriter;
+    }
+
+    public XMLStreamWriter getXmlStreamWriter() {
+        return xmlWriter;
+    }
+
+    public String getMimeBoundary() {
+        return format.getMimeBoundary();
+    }
+
+    public String getRootContentId() {
+        return format.getRootContentId();
+    }
+
+    public String getNextContentId() {
+        return format.getNextContentId();
+    }
+
+    /**
+     * Returns the character set encoding scheme. If the value of the
+     * charSetEncoding is not set then the default will be returned.
+     *
+     * @return Returns encoding.
+     */
+    public String getCharSetEncoding() {
+        return format.getCharSetEncoding();
+    }
+
+    public void setCharSetEncoding(String charSetEncoding) {
+        format.setCharSetEncoding(charSetEncoding);
+    }
+
+    public String getXmlVersion() {
+        return format.getXmlVersion();
+    }
+
+    public void setXmlVersion(String xmlVersion) {
+        format.setXmlVersion(xmlVersion);
+    }
+
+    public void setSoap11(boolean b) {
+        format.setSOAP11(b);
+    }
+
+    public boolean isIgnoreXMLDeclaration() {
+        return format.isIgnoreXMLDeclaration();
+    }
+
+    public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
+        format.setIgnoreXMLDeclaration(ignoreXMLDeclaration);
+    }
+
+    public void setDoOptimize(boolean b) {
+        format.setDoOptimize(b);
+    }
+
+    public void setOutputFormat(OMOutputFormat format) {
+        this.format = format;
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/OMNodeEx.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/OMNodeEx.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/OMNodeEx.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/OMNodeEx.java Tue Apr  4 18:10:36 2006
@@ -43,17 +43,17 @@
     /**
      * Serializes the node with caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws javax.xml.stream.XMLStreamException
      */
-    public void internalSerialize(OMOutputImpl omOutput)
+    public void internalSerialize(XMLStreamWriter writer)
             throws XMLStreamException;
 
     /**
      * Serializes the node without caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException;
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException;
 }

Modified: 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=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/AttrImpl.java Tue Apr  4 18:10:36 2006
@@ -22,7 +22,7 @@
 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.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Element;
@@ -31,6 +31,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 
 /**
  * Implementation of <code>org.w3c.dom.Attr</code> and
@@ -62,13 +63,13 @@
      * 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) {
+                    OMNamespace ns, String value, OMFactory factory) {
         super(ownerDocument, factory);
         this.attrName = localName;
         this.attrValue = new TextImpl(ownerDocument, value, factory);
@@ -76,7 +77,7 @@
     }
 
     public AttrImpl(DocumentImpl ownerDocument, String name, String value,
-            OMFactory factory) {
+                    OMFactory factory) {
         super(ownerDocument, factory);
         this.attrName = name;
         this.attrValue = new TextImpl(ownerDocument, value, factory);
@@ -94,7 +95,7 @@
     }
 
     public AttrImpl(DocumentImpl ownerDocument, String localName,
-            OMNamespace namespace, OMFactory factory) {
+                    OMNamespace namespace, OMFactory factory) {
         super(ownerDocument, factory);
         this.attrName = localName;
         this.namespace = (NamespaceImpl) namespace;
@@ -108,7 +109,7 @@
      */
     public String getNodeName() {
         return (this.namespace != null
-                && !"".equals(this.namespace.getPrefix()) && !(OMConstants.XMLNS_NS_PREFIX.equals(this.attrName))) 
+                && !"".equals(this.namespace.getPrefix()) && !(OMConstants.XMLNS_NS_PREFIX.equals(this.attrName)))
                 ? this.namespace.getPrefix()+ ":" + this.attrName
                 : this.attrName;
     }
@@ -197,7 +198,7 @@
      * This is not supported since attributes serialization is handled by the
      * serialization of the owner nodes.
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         throw new UnsupportedOperationException("Not supported");
     }
 
@@ -206,9 +207,9 @@
      * serialization of the owner nodes.
      * 
      * @see org.apache.axiom.om.impl.OMNodeEx#internalSerializeAndConsume
-     * (org.apache.axiom.om.impl.OMOutputImpl)
+     * (org.apache.axiom.om.impl.MTOMXMLStreamWriter)
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
         throw new UnsupportedOperationException("Not supported");
     }

Modified: 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=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/CommentImpl.java Tue Apr  4 18:10:36 2006
@@ -19,7 +19,7 @@
 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.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.w3c.dom.Comment;
 import org.w3c.dom.Node;
 
@@ -64,14 +64,13 @@
                 "You should not set the node type of a comment");
     }
 
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         writer.writeComment(this.textValue.toString());
     }
 
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
-        internalSerialize(omOutput);
+        internalSerialize(writer);
     }
 
 }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java Tue Apr  4 18:10:36 2006
@@ -17,7 +17,7 @@
 
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
 
@@ -70,7 +70,7 @@
         // DO Nothing :-?
     }
 
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         // TODO
         throw new UnsupportedOperationException("TODO");
     }
@@ -80,7 +80,7 @@
         throw new UnsupportedOperationException("TODO");
     }
 
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
         // TODO
         throw new UnsupportedOperationException("TODO");

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/DocumentImpl.java Tue Apr  4 18:10:36 2006
@@ -24,7 +24,7 @@
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
@@ -90,7 +90,7 @@
                 "In OM Document object doesn't have a type");
     }
 
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         // TODO Auto-generated method stub
     }
 
@@ -339,7 +339,7 @@
         throw new UnsupportedOperationException("TODO");
     }
 
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
         // TODO
         throw new UnsupportedOperationException("TODO");

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/ElementImpl.java Tue Apr  4 18:10:36 2006
@@ -25,7 +25,7 @@
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
 import org.apache.axiom.om.impl.llom.OMSerializerUtil;
@@ -1042,18 +1042,18 @@
         throw new UnsupportedOperationException();
     }
 
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerialize(omOutput, true);
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer, true);
     }
 
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
-        this.internalSerialize(omOutput, false);
+        this.internalSerialize(writer, false);
     }
 
-    protected void internalSerialize(org.apache.axiom.om.impl.OMOutputImpl omOutput,
+    protected void internalSerialize(XMLStreamWriter writer,
                                      boolean cache) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+
         if (!cache) {
             // in this case we don't care whether the elements are built or not
             // we just call the serializeAndConsume methods
@@ -1061,7 +1061,7 @@
             // serilize children
             Iterator children = this.getChildren();
             while (children.hasNext()) {
-                ((OMNodeEx) children.next()).internalSerialize(omOutput);
+                ((OMNodeEx) children.next()).internalSerialize(writer);
             }
             OMSerializerUtil.serializeEndpart(writer);
 
@@ -1075,7 +1075,7 @@
                 while (child != null
                         && ((!(child instanceof OMElement)) || child
                         .isComplete())) {
-                    child.internalSerializeAndConsume(omOutput);
+                    child.internalSerializeAndConsume(writer);
                     child = child.nextSibling;
                 }
                 if (child != null) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NodeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/NodeImpl.java Tue Apr  4 18:10:36 2006
@@ -22,7 +22,7 @@
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -397,9 +397,9 @@
     /**
      * There no concept of caching in this OM-DOM implementation.
      */
-    public void internalSerializeWithCache(OMOutputImpl omOutput)
+    public void internalSerializeWithCache(XMLStreamWriter writer)
             throws XMLStreamException {
-        this.internalSerialize(omOutput);
+        this.internalSerialize(writer);
     }
 
     /*
@@ -479,16 +479,16 @@
     }
 
     public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(xmlWriter);
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerialize(writer);
+        writer.flush();
     }
 
     public void serializeAndConsume(XMLStreamWriter xmlWriter)
             throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(xmlWriter);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
     public OMNode detach() {
@@ -579,34 +579,34 @@
 
     public void serialize(OutputStream output, OMOutputFormat format)
             throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, format);
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerialize(writer);
+        writer.flush();
     }
 
-    public void serialize(Writer writer, OMOutputFormat format)
+    public void serialize(Writer writer2, OMOutputFormat format)
             throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(XMLOutputFactory.newInstance()
-                .createXMLStreamWriter(writer));
-        omOutput.setOutputFormat(format);
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(XMLOutputFactory.newInstance()
+                .createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerialize(writer);
+        writer.flush();
     }
 
     public void serializeAndConsume(OutputStream output, OMOutputFormat format)
             throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, format);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
-    public void serializeAndConsume(Writer writer, OMOutputFormat format)
+    public void serializeAndConsume(Writer writer2, OMOutputFormat format)
             throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(XMLOutputFactory.newInstance()
-                .createXMLStreamWriter(writer));
-        omOutput.setOutputFormat(format);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(XMLOutputFactory.newInstance()
+                .createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/TextImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/TextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/dom/TextImpl.java Tue Apr  4 18:10:36 2006
@@ -23,7 +23,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;
 import org.apache.axiom.om.util.Base64;
 import org.apache.axiom.om.util.UUIDGenerator;
@@ -235,13 +235,13 @@
         // Its not clear why we should let someone change the type of a node
     }
 
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerializeLocal(omOutput);
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerializeLocal(writer);
     }
 
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
-        internalSerializeLocal(omOutput);
+        internalSerializeLocal(writer);
     }
 
     public boolean isOptimized() {
@@ -359,15 +359,15 @@
         }
     }
 
-    private void internalSerializeLocal(OMOutputImpl omOutput)
+    private void internalSerializeLocal(XMLStreamWriter writer2)
             throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
         if (!this.isBinary) {
             writeOutput(writer);
         } else {
-            if (omOutput.isOptimized()) {
+            if (writer.isOptimized()) {
                 if (contentID == null) {
-                    contentID = omOutput.getNextContentId();
+                    contentID = writer.getNextContentId();
                 }
                 // send binary as MTOM optimised
                 this.attribute = new AttrImpl(this.ownerNode, "href",
@@ -375,7 +375,7 @@
                         "cid:" + getContentID(),
                         this.factory);
                 this.serializeStartpart(writer);
-                omOutput.writeOptimized(this);
+                writer.writeOptimized(this);
                 writer.writeEndElement();
             } else {
                 writer.writeCharacters(this.getText());
@@ -430,7 +430,7 @@
      * Method serializeAttribute.
      * 
      * @param attr
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
      */
     static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMCommentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMCommentImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMCommentImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMCommentImpl.java Tue Apr  4 18:10:36 2006
@@ -22,7 +22,7 @@
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
@@ -56,23 +56,21 @@
     /**
      * Serializes the node with caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         writer.writeComment(this.value);
     }
 
     /**
      * Serializes the node without caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
-     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl)
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerialize(omOutput);
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer);
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java Tue Apr  4 18:10:36 2006
@@ -22,7 +22,7 @@
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
@@ -55,23 +55,21 @@
     /**
      * Serializes the node with caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         writer.writeDTD(this.value);
     }
 
     /**
      * Serializes the node without caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
-     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl)
      */
-    public void internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerialize(omOutput);
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer);
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocumentImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocumentImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMDocumentImpl.java Tue Apr  4 18:10:36 2006
@@ -25,12 +25,13 @@
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
 import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 import java.io.OutputStream;
 import java.util.Iterator;
 
@@ -324,24 +325,24 @@
     /**
      * Serialize the docuement with/without the XML declaration
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput, boolean includeXMLDeclaration) throws XMLStreamException {
-        internalSerialize(omOutput, false, includeXMLDeclaration);
+    public void internalSerializeAndConsume(XMLStreamWriter writer, boolean includeXMLDeclaration) throws XMLStreamException {
+        internalSerialize(writer, false, includeXMLDeclaration);
     }
 
     /**
      * Serializes the document with the XML declaration.
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
-        internalSerialize(omOutput, false, !omOutput.isIgnoreXMLDeclaration());
+        internalSerialize(writer, false, !((MTOMXMLStreamWriter)writer).isIgnoreXMLDeclaration());
     }
 
 
     /**
      * Serializes the document with cache.
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerialize(omOutput, true, !omOutput.isIgnoreXMLDeclaration());
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer, true, !((MTOMXMLStreamWriter)writer).isIgnoreXMLDeclaration());
 
     }
 
@@ -352,9 +353,9 @@
      * @throws XMLStreamException
      */
     public void serializeAndConsume(OutputStream output) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, new OMOutputFormat());
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, new OMOutputFormat());
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
     /**
@@ -364,9 +365,9 @@
      * @throws XMLStreamException
      */
     public void serialize(OutputStream output) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, new OMOutputFormat());
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, new OMOutputFormat());
+        internalSerialize(writer);
+        writer.flush();
     }
 
     /**
@@ -377,9 +378,9 @@
      * @throws XMLStreamException
      */
     public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, format);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
     /**
@@ -390,29 +391,30 @@
      * @throws XMLStreamException
      */
     public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, format);
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerialize(writer);
+        writer.flush();
     }
 
     /**
      * Serializes the document with cache.
      */
-    public void internalSerialize(OMOutputImpl omOutput, boolean includeXMLDeclaration) throws XMLStreamException {
-        internalSerialize(omOutput, true, includeXMLDeclaration);
+    public void internalSerialize(XMLStreamWriter writer, boolean includeXMLDeclaration) throws XMLStreamException {
+        internalSerialize(writer, true, includeXMLDeclaration);
 
     }
 
-    protected void internalSerialize(OMOutputImpl omOutput, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException {
+    protected void internalSerialize(XMLStreamWriter writer2, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
         if (includeXMLDeclaration) {
             //Check whether the OMOutput char encoding and OMDocument char
             //encoding matches, if not use char encoding of OMOutput
-            String outputCharEncoding = omOutput.getCharSetEncoding();
+            String outputCharEncoding = writer.getCharSetEncoding();
             if (outputCharEncoding == null || "".equals(outputCharEncoding)) {
-                omOutput.getXmlStreamWriter().writeStartDocument(charSetEncoding,
+                writer.getXmlStreamWriter().writeStartDocument(charSetEncoding,
                         xmlVersion);
             } else {
-                omOutput.getXmlStreamWriter().writeStartDocument(outputCharEncoding,
+                writer.getXmlStreamWriter().writeStartDocument(outputCharEncoding,
                         xmlVersion);
             }
         }
@@ -422,12 +424,12 @@
         if (cache) {
             while (children.hasNext()) {
                 OMNodeEx omNode = (OMNodeEx) children.next();
-                omNode.internalSerialize(omOutput);
+                omNode.internalSerialize(writer);
             }
         } else {
             while (children.hasNext()) {
                 OMNodeEx omNode = (OMNodeEx) children.next();
-                omNode.internalSerializeAndConsume(omOutput);
+                omNode.internalSerializeAndConsume(writer);
             }
         }
     }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMElementImpl.java Tue Apr  4 18:10:36 2006
@@ -29,7 +29,7 @@
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.llom.util.EmptyIterator;
 import org.apache.axiom.om.impl.traverse.OMChildElementIterator;
@@ -747,15 +747,15 @@
      *
      * @throws XMLStreamException
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerialize(omOutput, true);
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer, true);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////
 
-    protected void internalSerialize(OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+
         if (cache) {
             //in this case we don't care whether the elements are built or not
             //we just call the serializeAndConsume methods
@@ -763,7 +763,7 @@
             //serialize children
             Iterator children = this.getChildren();
             while (children.hasNext()) {
-                ((OMNodeEx) children.next()).internalSerialize(omOutput);
+                ((OMNodeEx) children.next()).internalSerialize(writer);
             }
             OMSerializerUtil.serializeEndpart(writer);
 
@@ -774,7 +774,7 @@
                 OMSerializerUtil.serializeStartpart(this, writer);
                 OMNodeImpl child = (OMNodeImpl) firstChild;
                 while (child != null && ((!(child instanceof OMElement)) || child.isComplete())) {
-                    child.internalSerializeAndConsume(omOutput);
+                    child.internalSerializeAndConsume(writer);
                     child = child.nextSibling;
                 }
                 if (child != null) {
@@ -802,8 +802,8 @@
      *
      * @throws XMLStreamException
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException {
-        this.internalSerialize(omOutput, false);
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        this.internalSerialize(writer, false);
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMNodeImpl.java Tue Apr  4 18:10:36 2006
@@ -24,7 +24,7 @@
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -302,9 +302,9 @@
      * @throws javax.xml.stream.XMLStreamException
      */
     public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(xmlWriter);
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerialize(writer);
+        writer.flush();
     }
 
     /**
@@ -313,33 +313,33 @@
      * @param xmlWriter
      * @throws javax.xml.stream.XMLStreamException
      *
-     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl)
+     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.MTOMXMLStreamWriter)
      */
     public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(xmlWriter);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
     /**
      * Serializes the node with caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
-     * @see #internalSerialize(org.apache.axiom.om.impl.OMOutputImpl)
+     * @see #internalSerialize(org.apache.axiom.om.impl.MTOMXMLStreamWriter)
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         throw new RuntimeException("Not implemented yet!");
     }
 
     /**
      * Serializes the node without caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
-     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl)
+     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.MTOMXMLStreamWriter)
      */
-    public void internalSerializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException {
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
         throw new RuntimeException("Not implemented yet!");
     }
 
@@ -360,29 +360,29 @@
     }
 
     public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, format);
-        internalSerialize(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerialize(writer);
+        writer.flush();
     }
 
-    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
-        omOutput.setOutputFormat(format);
-        internalSerialize(omOutput);
-        omOutput.flush();
+    public void serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(XMLOutputFactory.newInstance().createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerialize(writer);
+        writer.flush();
     }
 
     public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(output, format);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
-    public void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException {
-        OMOutputImpl omOutput = new OMOutputImpl(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
-        omOutput.setOutputFormat(format);
-        internalSerializeAndConsume(omOutput);
-        omOutput.flush();
+    public void serializeAndConsume(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(XMLOutputFactory.newInstance().createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
     }
 
     public OMFactory getOMFactory() {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java Tue Apr  4 18:10:36 2006
@@ -58,24 +58,21 @@
     /**
      * Serializes the node with caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
-     * @see #internalSerialize(org.apache.axiom.om.impl.OMOutputImpl)
      */
-    public void internalSerialize(org.apache.axiom.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
         writer.writeProcessingInstruction(this.target+" ", this.value);
     }
 
     /**
      * Serializes the node without caching.
      *
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
-     * @see #internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl)
      */
-    public void internalSerializeAndConsume(org.apache.axiom.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerialize(omOutput);
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer);
     }
 
     /**

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java Tue Apr  4 18:10:36 2006
@@ -25,7 +25,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;
 import org.apache.axiom.om.util.Base64;
 import org.apache.axiom.om.util.UUIDGenerator;
@@ -191,11 +191,11 @@
     }
 
     /**
-     * @param omOutput
+     * @param writer
      * @throws XMLStreamException
      */
-    public void internalSerialize(OMOutputImpl omOutput) throws XMLStreamException {
-        internalSerializeLocal(omOutput);
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerializeLocal(writer);
     }
 
     /**
@@ -367,30 +367,30 @@
         return true;
     }
 
-    public void internalSerializeAndConsume(OMOutputImpl omOutput)
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
             throws XMLStreamException {
-        internalSerializeLocal(omOutput);
+        internalSerializeLocal(writer);
     }
 
-    private void internalSerializeLocal(OMOutputImpl omOutput) throws XMLStreamException {
-        XMLStreamWriter xmlStreamWriter = omOutput.getXmlStreamWriter();
+    private void internalSerializeLocal(XMLStreamWriter writer2) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
 
         if (!this.isBinary) {
-            writeOutput(xmlStreamWriter);
+            writeOutput(writer);
         } else {
 
-            if (omOutput.isOptimized()) {
+            if (writer.isOptimized()) {
                 if (contentID == null) {
-                    contentID = omOutput.getNextContentId();
+                    contentID = writer.getNextContentId();
                 }
                 // send binary as MTOM optimised
                 this.attribute = new OMAttributeImpl("href",
                         new OMNamespaceImpl("", ""), "cid:" + getContentID(), this.factory);
-                this.serializeStartpart(xmlStreamWriter);
-                omOutput.writeOptimized(this);
-                xmlStreamWriter.writeEndElement();
+                this.serializeStartpart(writer);
+                writer.writeOptimized(this);
+                writer.writeEndElement();
             } else {
-                xmlStreamWriter.writeCharacters(this.getText());
+                writer.writeCharacters(this.getText());
             }
         }
     }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Tue Apr  4 18:10:36 2006
@@ -22,7 +22,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.dom.DocumentImpl;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPBody;
@@ -35,54 +35,55 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 
 public class SOAPEnvelopeImpl extends SOAPElement implements SOAPEnvelope,
-		OMConstants {
+        OMConstants {
 
 
-	/**
-	 * @param builder
-	 */
-	public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
-		super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory);
-	}
-
-	public SOAPEnvelopeImpl(DocumentImpl doc, OMXMLParserWrapper builder, SOAPFactory factory) {
-		super(
-				doc,
-				SOAPConstants.SOAPENVELOPE_LOCAL_NAME,
+    /**
+     * @param builder
+     */
+    public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory);
+    }
+
+    public SOAPEnvelopeImpl(DocumentImpl doc, OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(
+                doc,
+                SOAPConstants.SOAPENVELOPE_LOCAL_NAME,
                 null,
-				builder, factory);
-	}
-	/**
-	 * @param ns
-	 */
-	public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
-		super(((DOMSOAPFactory) factory).getDocument(),
-				SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory);
-		this.getOwnerDocument().appendChild(this);
-	}
-
-	/**
-	 * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE>
-	 * object.
-	 * <P>
-	 * This SOAPHeader will just be a container for all the headers in the
-	 * <CODE>OMMessage</CODE>
-	 * </P>
-	 *
-	 * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if
-	 *         there is none
-	 * @throws org.apache.axiom.om.OMException
-	 *             if there is a problem obtaining the <CODE>SOAPHeader</CODE>
-	 *             object
-	 * @throws OMException
-	 */
-	public SOAPHeader getHeader() throws OMException {
-		SOAPHeader header =
+                builder, factory);
+    }
+    /**
+     * @param ns
+     */
+    public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
+        super(((DOMSOAPFactory) factory).getDocument(),
+                SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory);
+        this.getOwnerDocument().appendChild(this);
+    }
+
+    /**
+     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE>
+     * object.
+     * <P>
+     * This SOAPHeader will just be a container for all the headers in the
+     * <CODE>OMMessage</CODE>
+     * </P>
+     *
+     * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if
+     *         there is none
+     * @throws org.apache.axiom.om.OMException
+     *             if there is a problem obtaining the <CODE>SOAPHeader</CODE>
+     *             object
+     * @throws OMException
+     */
+    public SOAPHeader getHeader() throws OMException {
+        SOAPHeader header =
                 (SOAPHeader) getFirstChildWithName(new QName(SOAPConstants.HEADER_LOCAL_NAME));
-		return header;
-	}
+        return header;
+    }
 
     public void addChild(OMNode child) {
         if ((child instanceof OMElement)
@@ -95,76 +96,77 @@
         }
     }
 
-	/**
-	 * Returns the <CODE>SOAPBody</CODE> object associated with this <CODE>SOAPEnvelope</CODE>
-	 * object.
-	 * <P>
-	 * This SOAPBody will just be a container for all the BodyElements in the
-	 * <CODE>OMMessage</CODE>
-	 * </P>
-	 *
-	 * @return the <CODE>SOAPBody</CODE> object for this <CODE> SOAPEnvelope</CODE>
-	 *         object or <CODE>null</CODE> if there is none
-	 * @throws org.apache.axiom.om.OMException
-	 *             if there is a problem obtaining the <CODE>SOAPBody</CODE>
-	 *             object
-	 * @throws OMException
-	 */
-	public SOAPBody getBody() throws OMException {
-		// check for the first element
-		OMElement element = getFirstElement();
-		if (element != null) {
-			if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
-				return (SOAPBody) element;
-			} else { // if not second element SHOULD be the body
-				OMNode node = element.getNextOMSibling();
-				while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
-					node = node.getNextOMSibling();
-				}
-				element = (OMElement) node;
-
-				if (node != null
-						&& SOAPConstants.BODY_LOCAL_NAME.equals(element
-								.getLocalName())) {
-					return (SOAPBody) element;
-				}
+    /**
+     * Returns the <CODE>SOAPBody</CODE> object associated with this <CODE>SOAPEnvelope</CODE>
+     * object.
+     * <P>
+     * This SOAPBody will just be a container for all the BodyElements in the
+     * <CODE>OMMessage</CODE>
+     * </P>
+     *
+     * @return the <CODE>SOAPBody</CODE> object for this <CODE> SOAPEnvelope</CODE>
+     *         object or <CODE>null</CODE> if there is none
+     * @throws org.apache.axiom.om.OMException
+     *             if there is a problem obtaining the <CODE>SOAPBody</CODE>
+     *             object
+     * @throws OMException
+     */
+    public SOAPBody getBody() throws OMException {
+        // check for the first element
+        OMElement element = getFirstElement();
+        if (element != null) {
+            if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+                return (SOAPBody) element;
+            } else { // if not second element SHOULD be the body
+                OMNode node = element.getNextOMSibling();
+                while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
+                    node = node.getNextOMSibling();
+                }
+                element = (OMElement) node;
+
+                if (node != null
+                        && SOAPConstants.BODY_LOCAL_NAME.equals(element
+                                .getLocalName())) {
+                    return (SOAPBody) element;
+                }
               /*  else {
 					throw new OMException(
 							"SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.");
 				}*/
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * Method detach
-	 * 
-	 * @throws OMException
-	 */
-	public OMNode detach() throws OMException {
-		throw new OMException("Root Element can not be detached");
-	}
-
-	protected void checkParent(OMElement parent) throws SOAPProcessingException {
-		// here do nothing as SOAPEnvelope doesn't have a parent !!!
-	}
-
-	protected void internalSerialize(OMOutputImpl omOutput, boolean cache)
-			throws XMLStreamException {
-
-		if (!omOutput.isIgnoreXMLDeclaration()) {
-			String charSetEncoding = omOutput.getCharSetEncoding();
-			String xmlVersion = omOutput.getXmlVersion();
-			omOutput
-					.getXmlStreamWriter()
-					.writeStartDocument(
-							charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING
-									: charSetEncoding,
-							xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION
-									: xmlVersion);
-		}
-		super.internalSerialize(omOutput, cache);
-	}
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Method detach
+     *
+     * @throws OMException
+     */
+    public OMNode detach() throws OMException {
+        throw new OMException("Root Element can not be detached");
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        // here do nothing as SOAPEnvelope doesn't have a parent !!!
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer2, boolean cache)
+            throws XMLStreamException {
+
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+        if (!writer.isIgnoreXMLDeclaration()) {
+            String charSetEncoding = writer.getCharSetEncoding();
+            String xmlVersion = writer.getXmlVersion();
+            writer
+                    .getXmlStreamWriter()
+                    .writeStartDocument(
+                            charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING
+                                    : charSetEncoding,
+                            xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION
+                                    : xmlVersion);
+        }
+        super.internalSerialize(writer, cache);
+    }
 
 }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java Tue Apr  4 18:10:36 2006
@@ -17,7 +17,7 @@
 package org.apache.axiom.soap.impl.dom;
 
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.llom.OMSerializerUtil;
 import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axiom.om.util.ElementHelper;
@@ -77,7 +77,7 @@
                 SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
     }
 
-    protected void internalSerialize(OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
         // select the builder
         short builderType = PULL_TYPE_BUILDER;    // default is pull type
         if (builder != null) {
@@ -85,15 +85,14 @@
         }
         if ((builderType == PUSH_TYPE_BUILDER)
                 && (builder.getRegisteredContentHandler() == null)) {
-            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
         }
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (!cache) {
             //No caching
             if (this.firstChild != null) {
                 OMSerializerUtil.serializeStartpart(this, writer);
-                firstChild.internalSerializeAndConsume(omOutput);
+                firstChild.internalSerializeAndConsume(writer);
                 OMSerializerUtil.serializeEndpart(writer);
             } else if (!this.done) {
                 if (builderType == PULL_TYPE_BUILDER) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java Tue Apr  4 18:10:36 2006
@@ -60,7 +60,7 @@
         return this.getChildren();
     }
 
-    protected void internalSerialize(org.apache.axiom.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
         // select the builder
         short builderType = PULL_TYPE_BUILDER;    // default is pull type
         if (builder != null) {
@@ -68,15 +68,14 @@
         }
         if ((builderType == PUSH_TYPE_BUILDER)
                 && (builder.getRegisteredContentHandler() == null)) {
-            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
         }
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (!cache) {
             //No caching
             if (this.firstChild != null) {
                 OMSerializerUtil.serializeStartpart(this, writer);
-                firstChild.internalSerializeAndConsume(omOutput);
+                firstChild.internalSerializeAndConsume(writer);
                 OMSerializerUtil.serializeEndpart(writer);
             } else if (!this.done) {
                 if (builderType == PULL_TYPE_BUILDER) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java Tue Apr  4 18:10:36 2006
@@ -191,7 +191,7 @@
 		return null;
 	}
 
-	protected void internalSerialize(org.apache.axiom.om.impl.OMOutputImpl omOutput,
+	protected void internalSerialize(XMLStreamWriter writer,
                                      boolean cache) throws XMLStreamException {
 		// select the builder
 		short builderType = PULL_TYPE_BUILDER; // default is pull type
@@ -202,7 +202,7 @@
 				&& (builder.getRegisteredContentHandler() == null)) {
 			builder
 					.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(
-							omOutput.getXmlStreamWriter()));
+							writer));
 		}
 
 		// this is a special case. This fault element may contain its children
@@ -211,7 +211,6 @@
 		// the best method to do this :(
 		build();
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         OMSerializerUtil.serializeStartpart(this, writer);
 		SOAPFaultCode faultCode = getCode();
 		if (faultCode != null) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java Tue Apr  4 18:10:36 2006
@@ -50,7 +50,7 @@
     }
 
     protected void internalSerialize(
-            org.apache.axiom.om.impl.OMOutputImpl omOutput, boolean cache)
+            XMLStreamWriter writer, boolean cache)
             throws XMLStreamException {
             // select the builder
             short builderType = PULL_TYPE_BUILDER;    // default is pull type
@@ -60,15 +60,14 @@
             if ((builderType == PUSH_TYPE_BUILDER)
                     && (builder.getRegisteredContentHandler() == null)) {
                 builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(
-                            omOutput.getXmlStreamWriter()));
+                            writer));
             }
 
-            XMLStreamWriter writer = omOutput.getXmlStreamWriter();
             if (!cache) {
                 //No caching
                 if (this.firstChild != null) {
                     OMSerializerUtil.serializeStartpart(this, writer);
-                    firstChild.internalSerializeAndConsume(omOutput);
+                    firstChild.internalSerializeAndConsume(writer);
                     OMSerializerUtil.serializeEndpart(writer);
                 } else if (!this.done) {
                     if (builderType == PULL_TYPE_BUILDER) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java Tue Apr  4 18:10:36 2006
@@ -70,7 +70,7 @@
                 SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
     }
 
-    protected void internalSerialize(org.apache.axiom.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
         // select the builder
         short builderType = PULL_TYPE_BUILDER;    // default is pull type
         if (builder != null) {
@@ -78,16 +78,14 @@
         }
         if ((builderType == PUSH_TYPE_BUILDER)
                 && (builder.getRegisteredContentHandler() == null)) {
-            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
         }
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
-
         if (!cache) {
             //No caching
             if (this.firstChild != null) {
                 OMSerializerUtil.serializeStartpart(this, writer);
-                firstChild.internalSerializeAndConsume(omOutput);
+                firstChild.internalSerializeAndConsume(writer);
                 OMSerializerUtil.serializeEndpart(writer);
             } else if (!this.done) {
                 if (builderType == PULL_TYPE_BUILDER) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java Tue Apr  4 18:10:36 2006
@@ -17,7 +17,7 @@
 package org.apache.axiom.soap.impl.dom;
 
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.llom.OMSerializerUtil;
 import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axiom.soap.SOAP12Constants;
@@ -57,7 +57,7 @@
         return this.getText();
     }
 
-    protected void internalSerialize(OMOutputImpl omOutput, boolean cache)
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache)
             throws XMLStreamException {
         // select the builder
         short builderType = PULL_TYPE_BUILDER;    // default is pull type
@@ -67,15 +67,14 @@
         if ((builderType == PUSH_TYPE_BUILDER)
             && (builder.getRegisteredContentHandler() == null)) {
             builder.registerExternalContentHandler(
-                    new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+                    new StreamWriterToContentHandlerConverter(writer));
         }
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (!cache) {
             //No caching
             if (this.firstChild != null) {
                 OMSerializerUtil.serializeStartpart(this, writer);
-                firstChild.internalSerializeAndConsume(omOutput);
+                firstChild.internalSerializeAndConsume(writer);
                 OMSerializerUtil.serializeEndpart(writer);
             } else if (!this.done) {
                 if (builderType == PULL_TYPE_BUILDER) {

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java Tue Apr  4 18:10:36 2006
@@ -18,7 +18,7 @@
 
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMNodeEx;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.dom.DocumentImpl;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
@@ -26,6 +26,7 @@
 import org.apache.axiom.soap.SOAPProcessingException;
 
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 
 public class SOAPMessageImpl extends DocumentImpl implements SOAPMessage {
 
@@ -34,9 +35,9 @@
     }
 
     public SOAPMessageImpl(SOAPEnvelope envelope,
-            OMXMLParserWrapper parserWrapper, SOAPFactory factory) {
-    	this(parserWrapper, factory);
-    	this.setSOAPEnvelope(envelope);
+                           OMXMLParserWrapper parserWrapper, SOAPFactory factory) {
+        this(parserWrapper, factory);
+        this.setSOAPEnvelope(envelope);
     }
 
     public SOAPMessageImpl(OMXMLParserWrapper parserWrapper, SOAPFactory factory) {
@@ -51,15 +52,15 @@
 
     public void setSOAPEnvelope(SOAPEnvelope envelope)
             throws SOAPProcessingException {
-    	this.addChild(envelope);
+        this.addChild(envelope);
     }
 
-    protected void internalSerialize(OMOutputImpl omOutput, boolean cache,
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache,
                                      boolean includeXMLDeclaration) throws XMLStreamException {
         if (cache) {
-            ((OMNodeEx)this.ownerNode.getDocumentElement()).internalSerialize(omOutput);
+            ((OMNodeEx)this.ownerNode.getDocumentElement()).internalSerialize(writer);
         } else {
-        	((OMNodeEx)this.ownerNode.getDocumentElement()).internalSerializeAndConsume(omOutput);
+            ((OMNodeEx)this.ownerNode.getDocumentElement()).internalSerializeAndConsume(writer);
         }
     }
 }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java Tue Apr  4 18:10:36 2006
@@ -79,7 +79,7 @@
     }
 
     protected void internalSerialize(
-            org.apache.axiom.om.impl.OMOutputImpl omOutput, boolean cache)
+            XMLStreamWriter writer, boolean cache)
             throws XMLStreamException {
 
         // select the builder
@@ -90,10 +90,9 @@
         if ((builderType == PUSH_TYPE_BUILDER)
                 && (builder.getRegisteredContentHandler() == null)) {
             builder.registerExternalContentHandler(
-                    new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+                    new StreamWriterToContentHandlerConverter(writer));
         }
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (this.getNamespace() != null) {
             String prefix = this.getNamespace().getPrefix();
             String nameSpaceName = this.getNamespace().getName();

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java Tue Apr  4 18:10:36 2006
@@ -18,7 +18,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.llom.OMSerializerUtil;
 import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axiom.soap.SOAP11Constants;
@@ -54,7 +54,7 @@
         }
     }
 
-    public void internalSerialize(OMOutputImpl omOutput, boolean cache)
+    public void internalSerialize(XMLStreamWriter writer, boolean cache)
             throws XMLStreamException {
 
         // select the builder
@@ -65,9 +65,9 @@
         if ((builderType == PUSH_TYPE_BUILDER)
                 && (builder.getRegisteredContentHandler() == null)) {
             builder.registerExternalContentHandler(
-                    new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+                    new StreamWriterToContentHandlerConverter(writer));
         }
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+
         if (this.getNamespace() != null) {
             String prefix = this.getNamespace().getPrefix();
             String nameSpaceName = this.getNamespace().getName();
@@ -86,7 +86,7 @@
 
 
         if (firstChild != null) {
-            firstChild.internalSerializeAndConsume(omOutput);
+            firstChild.internalSerializeAndConsume(writer);
         }
         writer.writeEndElement();
     }

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java Tue Apr  4 18:10:36 2006
@@ -60,15 +60,15 @@
         return new SOAP11FaultDetailImpl(fault, (SOAPFactory)this.factory);
     }
 
-    public void internalSerialize(org.apache.axiom.om.impl.OMOutputImpl omOutput)
+    public void internalSerialize(XMLStreamWriter writer)
             throws XMLStreamException {
-        super.internalSerialize(omOutput);
+        super.internalSerialize(writer);
     }
 
     public void internalSerializeAndConsume(
-            org.apache.axiom.om.impl.OMOutputImpl omOutput)
+            XMLStreamWriter writer)
             throws XMLStreamException {
-        super.internalSerializeAndConsume(omOutput);
+        super.internalSerializeAndConsume(writer);
     }
 
     public void setCode(SOAPFaultCode soapFaultCode)

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java?rev=391462&r1=391461&r2=391462&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java Tue Apr  4 18:10:36 2006
@@ -18,7 +18,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMOutputImpl;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.llom.OMSerializerUtil;
 import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axiom.soap.SOAP11Constants;
@@ -64,7 +64,7 @@
         }
     }
 
-    protected void internalSerialize(OMOutputImpl omOutput, boolean cache)
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache)
             throws XMLStreamException {
 
         // select the builder
@@ -75,10 +75,9 @@
         if ((builderType == PUSH_TYPE_BUILDER)
                 && (builder.getRegisteredContentHandler() == null)) {
             builder.registerExternalContentHandler(
-                    new StreamWriterToContentHandlerConverter(omOutput.getXmlStreamWriter()));
+                    new StreamWriterToContentHandlerConverter(writer));
         }
 
-        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
         if (this.getNamespace() != null) {
             String prefix = this.getNamespace().getPrefix();
             String nameSpaceName = this.getNamespace().getName();