axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r210150 [31/35] - in /webservices/axis/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/apache/axis2/handlers/addressing/ mod...
Date Mon, 11 Jul 2005 15:49:55 GMT
Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/MIMEOutputUtils.java Mon Jul 11 08:49:30 2005
@@ -29,111 +29,108 @@
  * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
  */
 public class MIMEOutputUtils {
-	
-	private static byte[] CRLF = { 13, 10 };
-	
-	static String SOAP_PART_CONTENT_ID = "<http://apache.org/soappart>";
-	
-	public static void complete(OutputStream outStream,
-			OutputStream bufferedSoapOutStream, LinkedList binaryNodeList,
-			String boundary) throws XMLStreamException {
-		try {
-			startWritingMime(outStream, boundary);
-			
-			DataHandler dh = new DataHandler(bufferedSoapOutStream.toString(),
-			"text/xml");
-			MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
-			rootMimeBodyPart.setDataHandler(dh);
-			ContentType partContentType = new ContentType("application/xop+xml");
-			partContentType.setParameter("charset","UTF-8");
-			partContentType.setParameter("type","application/soap+xml");
-			rootMimeBodyPart.addHeader("Content-Type",partContentType.toString() );
-			rootMimeBodyPart.addHeader("Content-Transfer-Encoding", "8bit");
-			rootMimeBodyPart.addHeader("Content-ID", SOAP_PART_CONTENT_ID);
-			
-			writeBodyPart(outStream, rootMimeBodyPart, boundary);
-			
-			Iterator binaryNodeIterator = binaryNodeList.iterator();
-			while (binaryNodeIterator.hasNext()) {
-				OMText binaryNode = (OMText) binaryNodeIterator.next();
-				writeBodyPart(outStream, createMimeBodyPart(binaryNode),
-						boundary);
-			}
-			finishWritingMime(outStream);
-		} catch (IOException e) {
-			throw new OMException("Problem with the OutputStream.",e);
-		} catch (MessagingException e) {
-			throw new OMException("Problem writing Mime Parts." ,e);
-		}
-	}
-	
-	protected static MimeBodyPart createMimeBodyPart(OMText node)
-	throws MessagingException {
-		MimeBodyPart mimeBodyPart = new MimeBodyPart();
-		mimeBodyPart.setDataHandler(node.getDataHandler());
-		mimeBodyPart.addHeader("Content-Transfer-Encoding", "binary");
-		mimeBodyPart.addHeader("Content-ID", "<" + node.getContentID() + ">");
-		return mimeBodyPart;
-		
-	}
-	
-	/**
-	 * @throws IOException
-	 *             This will write the boundary to output Stream
-	 */
-	protected static void writeMimeBoundary(OutputStream outStream,
-			String boundary) throws IOException {
-		outStream.write(new byte[] { 45, 45 });
-		outStream.write(boundary.getBytes());
-	}
-	
-	/**
-	 * @throws IOException
-	 *             This will write the boundary with CRLF
-	 */
-	protected static void startWritingMime(OutputStream outStream, String boundary)
-	throws IOException {
-		writeMimeBoundary(outStream, boundary);
-		//outStream.write(CRLF);
-	}
-	
-	/**
-	 * this will write a CRLF for the earlier boudary then the BodyPart data
-	 * with headers followed by boundary. Writes only the boundary. No more
-	 * CRLF's are wriiting after that.
-	 * 
-	 * @throws IOException
-	 * @throws MessagingException
-	 */
-	protected static void writeBodyPart(OutputStream outStream,
-			MimeBodyPart part, String boundary) throws IOException,
-			MessagingException {
-		outStream.write(CRLF);
-		part.writeTo(outStream);
-		outStream.write(CRLF);
-		writeMimeBoundary(outStream, boundary);
-	}
-	
-	/**
-	 * @throws IOException
-	 *             This will write "--" to the end of last boundary
-	 */
-	protected static void finishWritingMime(OutputStream outStream)
-	throws IOException {
-		outStream.write(new byte[] { 45, 45 });
-	}
-	
-	public static String getContentTypeForMime(String boundary) {
-		ContentType contentType = new ContentType();
-		contentType.setPrimaryType("multipart");
-		contentType.setSubType("related");
-		contentType.setParameter("boundary", boundary);
-		contentType.setParameter("start", MIMEOutputUtils.SOAP_PART_CONTENT_ID);
-		contentType.setParameter("type", "application/xop+xml");
-		//TODO theres something called action that can be set with
-		// following. May be SOAPAction. Better check.
-		contentType.setParameter("start-info", "application/soap+xml");
-		return contentType.toString();
-	}
-	
+
+    private static byte[] CRLF = {13, 10};
+
+    static String SOAP_PART_CONTENT_ID = "<http://apache.org/soappart>";
+
+    public static void complete(OutputStream outStream,
+                                OutputStream bufferedSoapOutStream, LinkedList binaryNodeList,
+                                String boundary) throws XMLStreamException {
+        try {
+            startWritingMime(outStream, boundary);
+
+            DataHandler dh = new DataHandler(bufferedSoapOutStream.toString(),
+                                             "text/xml");
+            MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
+            rootMimeBodyPart.setDataHandler(dh);
+            ContentType partContentType = new ContentType("application/xop+xml");
+            partContentType.setParameter("charset", "UTF-8");
+            partContentType.setParameter("type", "application/soap+xml");
+            rootMimeBodyPart.addHeader("Content-Type", partContentType.toString());
+            rootMimeBodyPart.addHeader("Content-Transfer-Encoding", "8bit");
+            rootMimeBodyPart.addHeader("Content-ID", SOAP_PART_CONTENT_ID);
+
+            writeBodyPart(outStream, rootMimeBodyPart, boundary);
+
+            Iterator binaryNodeIterator = binaryNodeList.iterator();
+            while (binaryNodeIterator.hasNext()) {
+                OMText binaryNode = (OMText) binaryNodeIterator.next();
+                writeBodyPart(outStream, createMimeBodyPart(binaryNode),
+                              boundary);
+            }
+            finishWritingMime(outStream);
+        } catch (IOException e) {
+            throw new OMException("Problem with the OutputStream.", e);
+        } catch (MessagingException e) {
+            throw new OMException("Problem writing Mime Parts.", e);
+        }
+    }
+
+    protected static MimeBodyPart createMimeBodyPart(OMText node)
+            throws MessagingException {
+        MimeBodyPart mimeBodyPart = new MimeBodyPart();
+        mimeBodyPart.setDataHandler(node.getDataHandler());
+        mimeBodyPart.addHeader("Content-Transfer-Encoding", "binary");
+        mimeBodyPart.addHeader("Content-ID", "<" + node.getContentID() + ">");
+        return mimeBodyPart;
+
+    }
+
+    /**
+     * @throws IOException This will write the boundary to output Stream
+     */
+    protected static void writeMimeBoundary(OutputStream outStream,
+                                            String boundary) throws IOException {
+        outStream.write(new byte[]{45, 45});
+        outStream.write(boundary.getBytes());
+    }
+
+    /**
+     * @throws IOException This will write the boundary with CRLF
+     */
+    protected static void startWritingMime(OutputStream outStream, String boundary)
+            throws IOException {
+        writeMimeBoundary(outStream, boundary);
+        //outStream.write(CRLF);
+    }
+
+    /**
+     * this will write a CRLF for the earlier boudary then the BodyPart data
+     * with headers followed by boundary. Writes only the boundary. No more
+     * CRLF's are wriiting after that.
+     *
+     * @throws IOException
+     * @throws MessagingException
+     */
+    protected static void writeBodyPart(OutputStream outStream,
+                                        MimeBodyPart part, String boundary) throws IOException,
+            MessagingException {
+        outStream.write(CRLF);
+        part.writeTo(outStream);
+        outStream.write(CRLF);
+        writeMimeBoundary(outStream, boundary);
+    }
+
+    /**
+     * @throws IOException This will write "--" to the end of last boundary
+     */
+    protected static void finishWritingMime(OutputStream outStream)
+            throws IOException {
+        outStream.write(new byte[]{45, 45});
+    }
+
+    public static String getContentTypeForMime(String boundary) {
+        ContentType contentType = new ContentType();
+        contentType.setPrimaryType("multipart");
+        contentType.setSubType("related");
+        contentType.setParameter("boundary", boundary);
+        contentType.setParameter("start", MIMEOutputUtils.SOAP_PART_CONTENT_ID);
+        contentType.setParameter("type", "application/xop+xml");
+        //TODO theres something called action that can be set with
+        // following. May be SOAPAction. Better check.
+        contentType.setParameter("start-info", "application/soap+xml");
+        return contentType.toString();
+    }
+
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMAbstractFactory.java Mon Jul 11 08:49:30 2005
@@ -41,6 +41,7 @@
     /**
      * If user needs to provide his own factory implementation, here provide the
      * Class Loader for that.
+     *
      * @param classLoader
      * @return
      */
@@ -60,6 +61,7 @@
     /**
      * If user needs to provide his own factory implementation, here provide the
      * Class Loader for that.
+     *
      * @param classLoader
      * @return
      */
@@ -79,6 +81,7 @@
     /**
      * If user needs to provide his own factory implementation, here provide the
      * Class Loader for that.
+     *
      * @param classLoader
      * @return
      */

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMConstants.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMConstants.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMConstants.java Mon Jul 11 08:49:30 2005
@@ -20,7 +20,7 @@
  */
 public interface OMConstants {
 
-       
+
     // OMBuilder constants
     /**
      * Field PUSH_TYPE_BUILDER
@@ -53,5 +53,5 @@
      */
     public static final String ARRAY_ITEM_QNAME =
             OMConstants.ARRAY_ITEM_NS_PREFIX + ':'
-                    + OMConstants.ARRAY_ITEM_LOCALNAME;
+            + OMConstants.ARRAY_ITEM_LOCALNAME;
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMContainer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMContainer.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMContainer.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMContainer.java Mon Jul 11 08:49:30 2005
@@ -20,21 +20,21 @@
 
 public interface OMContainer {
 
-	public void addChild (OMNode omNode);
+    public void addChild(OMNode omNode);
 
-	public Iterator getChildrenWithName (QName elementQName) throws OMException;
+    public Iterator getChildrenWithName(QName elementQName) throws OMException;
 
-	public OMElement getFirstChildWithName (QName elementQName) throws OMException;
+    public OMElement getFirstChildWithName(QName elementQName) throws OMException;
 
-	public Iterator getChildren();
+    public Iterator getChildren();
 
-	public void setFirstChild(OMNode omNode);
+    public void setFirstChild(OMNode omNode);
 
-	public OMNode getFirstChild();
+    public OMNode getFirstChild();
 
-	public boolean isComplete();
+    public boolean isComplete();
 
-	public void setComplete(boolean state);
+    public void setComplete(boolean state);
 
-	public void buildNext();
+    public void buildNext();
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMElement.java Mon Jul 11 08:49:30 2005
@@ -92,11 +92,10 @@
             throws OMException;
 
     /**
-     *
      * @return
      * @throws OMException
      */
-    public Iterator getAllDeclaredNamespaces()  throws OMException;
+    public Iterator getAllDeclaredNamespaces() throws OMException;
 
 
     /**
@@ -116,7 +115,6 @@
     public Iterator getAttributes();
 
     /**
-     *
      * @param qname
      * @return
      */
@@ -139,7 +137,7 @@
      * @return
      */
     public OMAttribute addAttribute(String attributeName, String value,
-                                       OMNamespace ns);
+                                    OMNamespace ns);
 
     /**
      * Method removeAttribute
@@ -178,13 +176,13 @@
 
     /**
      * Convenience extension of the getFirstChild
+     *
      * @return
      */
 
     public OMElement getFirstElement();
 
 
-
     /**
      * Returns the pull parser that will generate the pull
      * events relevant to THIS element. Caching is on
@@ -197,18 +195,18 @@
      * Returns the pull parser that will generate the pull
      * events relevant to THIS element.caching is off
      *
-     *
      * @return
      */
     public XMLStreamReader getXMLStreamReaderWithoutCaching();
 
     /**
-     * 
      * @param text
      */
     public void setText(String text);
+
     /**
      * This will return the non-empty text children as a String
+     *
      * @return
      */
     public String getText();
@@ -235,12 +233,14 @@
 
     /**
      * sets the Namespace
+     *
      * @param namespace
      */
     public void setNamespace(OMNamespace namespace);
 
     /**
      * Get the Qname of this node
+     *
      * @return
      */
     public QName getQName();

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java Mon Jul 11 08:49:30 2005
@@ -37,8 +37,8 @@
      * @return
      */
     public OMElement createOMElement(String localName, OMNamespace ns,
-                                              OMContainer parent,
-                                              OMXMLParserWrapper builder);
+                                     OMContainer parent,
+                                     OMXMLParserWrapper builder);
 
     /**
      * This is almost the same as as createOMElement(localName,OMNamespace) method above.
@@ -52,8 +52,8 @@
      * @return
      */
     public OMElement createOMElement(String localName,
-                                              String namespaceURI,
-                                              String namespacePrefix);
+                                     String namespaceURI,
+                                     String namespacePrefix);
 
     /**
      * QName(localPart),
@@ -87,10 +87,13 @@
      * @return
      */
     public OMText createText(String s);
+
     public OMText createText(String s, String mimeType, boolean optimize);
+
     public OMText createText(DataHandler dataHandler, boolean optimize);
+
     public OMText createText(OMElement parent, String s, String mimeType,
-			boolean optimize);
+                             boolean optimize);
 
     public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value);
 
@@ -99,5 +102,4 @@
     // make the constructor protected
 
 
-    
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java Mon Jul 11 08:49:30 2005
@@ -103,6 +103,7 @@
      * This will remove this information item and its children, from the model completely.
      * Important  to note that this method will detach the OMNode once it is fully built.
      * Half built nodes are not to be detached!
+     *
      * @throws OMException
      */
     public OMNode detach() throws OMException;
@@ -110,12 +111,14 @@
     /**
      * Discards a Node. Discrad goes to the parser level and if the element is not
      * completely built, then it will be completely skipped at the parser level
+     *
      * @throws OMException
      */
     public void discard() throws OMException;
 
     /**
      * This will insert a sibling just after the current information item.
+     *
      * @param sibling
      * @throws OMException
      */
@@ -131,6 +134,7 @@
 
     /**
      * This is to get the type of node, as this is the super class of all the nodes
+     *
      * @return
      * @throws OMException
      */
@@ -138,6 +142,7 @@
 
     /**
      * Method setType
+     *
      * @param nodeType
      * @throws OMException
      */
@@ -145,30 +150,34 @@
 
     /**
      * get the previous sibling
+     *
      * @return
      */
     public OMNode getPreviousSibling();
 
     /**
      * Set the previous sibling
+     *
      * @param previousSibling
      */
     public void setPreviousSibling(OMNode previousSibling);
 
     /**
      * Serialize the node with caching
-     * @see #serializeWithCache(javax.xml.stream.XMLStreamWriter)
+     *
      * @param writer
      * @throws XMLStreamException
+     * @see #serializeWithCache(javax.xml.stream.XMLStreamWriter)
      */
     public void serializeWithCache(OMOutput omOutput)
-        throws XMLStreamException;
+            throws XMLStreamException;
 
     /**
      * Serilaize the node without caching
-     * @see #serialize(javax.xml.stream.XMLStreamWriter)
+     *
      * @param writer
      * @throws XMLStreamException
+     * @see #serialize(javax.xml.stream.XMLStreamWriter)
      */
     public void serialize(OMOutput omOutput) throws XMLStreamException;
 

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMOutput.java Mon Jul 11 08:49:30 2005
@@ -31,104 +31,100 @@
  */
 
 public class OMOutput {
-	private XMLStreamWriter xmlWriter;
+    private XMLStreamWriter xmlWriter;
 
-	private boolean doOptimise;
+    private boolean doOptimise;
 
-	private OutputStream outStream;
+    private OutputStream outStream;
 
-	private XMLStreamWriter writer;
+    private XMLStreamWriter writer;
 
-	private LinkedList binaryNodeList;
-
-	private ByteArrayOutputStream bufferedSoapOutStream;
-
-	private static String mimeBoundary = "----=_AxIs2_Def_boundary_=42214532";
-
-	//private String contentType = null;
-
-	/**
-	 * @param xmlWriter
-	 *            if it is guaranteed for not using attachments one can use this
-	 */
-	public OMOutput(XMLStreamWriter xmlWriter) {
-		this.xmlWriter = xmlWriter;
-	}
-
-	/**
-	 * @throws FactoryConfigurationError
-	 * @throws XMLStreamException
-	 *  
-	 */
-	public OMOutput(OutputStream outStream, boolean doOptimise)
-			throws XMLStreamException, FactoryConfigurationError {
-		this.doOptimise = doOptimise;
-		this.outStream = outStream;
-		if (doOptimise) {
-			bufferedSoapOutStream = new ByteArrayOutputStream();
-			xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(
-					bufferedSoapOutStream);
-			binaryNodeList = new LinkedList();
-		} else {
-			xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(
-					outStream);
-
-		}
-
-	}
-
-	public XMLStreamWriter getXmlStreamWriter() {
-		return xmlWriter;
-	}
-
-	public void flush() throws XMLStreamException {
-		//		if (doOptimise) {
-		//			try {
-		//				this.complete();
-		//			} catch (IOException e) {
-		//				//TODO this is just a hack to avoid passing IOException. Must find a
-		// better way to handle this
-		//				throw new XMLStreamException("Error creating mime parts. Problem with
-		// Streams");
-		//			} catch (MessagingException e) {
-		//				throw new XMLStreamException("Error creating mime Body parts");
-		//			}
-		//		} else {
-		xmlWriter.flush();
-		//		}
-
-	}
-
-	public boolean doOptimise() {
-		return doOptimise;
-	}
-
-	public static String getContentType(boolean doOptimize) {
-		if (doOptimize) {
-			return MIMEOutputUtils.getContentTypeForMime(mimeBoundary);
-		}
-		//TODO have to check whether SOAP1.1 & SOAP 1.2
-		return null;
-	}
-
-	public void writeOptimised(OMText node) {
-		binaryNodeList.add(node);
-	}
-
-	public void complete() throws XMLStreamException {
-		if (doOptimise) {
-			xmlWriter.flush();
-			MIMEOutputUtils.complete(outStream, bufferedSoapOutStream,
-					binaryNodeList, mimeBoundary);
-		}
-	}
-
-	/*private String getMimeBoundary() {
-		//TODO have to dynamically generate.
-		if (mimeBoundary == null) {
-			mimeBoundary = "----=_AxIs2_Def_boundary_=42214532";
-		}
-		return mimeBoundary;
-	}*/
+    private LinkedList binaryNodeList;
+
+    private ByteArrayOutputStream bufferedSoapOutStream;
+
+    private static String mimeBoundary = "----=_AxIs2_Def_boundary_=42214532";
+
+    //private String contentType = null;
+
+    /**
+     * @param xmlWriter if it is guaranteed for not using attachments one can use this
+     */
+    public OMOutput(XMLStreamWriter xmlWriter) {
+        this.xmlWriter = xmlWriter;
+    }
+
+    /**
+     * @throws FactoryConfigurationError
+     * @throws XMLStreamException
+     */
+    public OMOutput(OutputStream outStream, boolean doOptimise)
+            throws XMLStreamException, FactoryConfigurationError {
+        this.doOptimise = doOptimise;
+        this.outStream = outStream;
+        if (doOptimise) {
+            bufferedSoapOutStream = new ByteArrayOutputStream();
+            xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(bufferedSoapOutStream);
+            binaryNodeList = new LinkedList();
+        } else {
+            xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream);
+
+        }
+
+    }
+
+    public XMLStreamWriter getXmlStreamWriter() {
+        return xmlWriter;
+    }
+
+    public void flush() throws XMLStreamException {
+        //		if (doOptimise) {
+        //			try {
+        //				this.complete();
+        //			} catch (IOException e) {
+        //				//TODO this is just a hack to avoid passing IOException. Must find a
+        // better way to handle this
+        //				throw new XMLStreamException("Error creating mime parts. Problem with
+        // Streams");
+        //			} catch (MessagingException e) {
+        //				throw new XMLStreamException("Error creating mime Body parts");
+        //			}
+        //		} else {
+        xmlWriter.flush();
+        //		}
+
+    }
+
+    public boolean doOptimise() {
+        return doOptimise;
+    }
+
+    public static String getContentType(boolean doOptimize) {
+        if (doOptimize) {
+            return MIMEOutputUtils.getContentTypeForMime(mimeBoundary);
+        }
+        //TODO have to check whether SOAP1.1 & SOAP 1.2
+        return null;
+    }
+
+    public void writeOptimised(OMText node) {
+        binaryNodeList.add(node);
+    }
+
+    public void complete() throws XMLStreamException {
+        if (doOptimise) {
+            xmlWriter.flush();
+            MIMEOutputUtils.complete(outStream, bufferedSoapOutStream,
+                                     binaryNodeList, mimeBoundary);
+        }
+    }
+
+    /*private String getMimeBoundary() {
+        //TODO have to dynamically generate.
+        if (mimeBoundary == null) {
+            mimeBoundary = "----=_AxIs2_Def_boundary_=42214532";
+        }
+        return mimeBoundary;
+    }*/
 
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java Mon Jul 11 08:49:30 2005
@@ -21,22 +21,22 @@
  * Interface OMText
  */
 public interface OMText extends OMNode {
-	/**
-	 * Returns the text value of this node
-	 * @return
-	 */
-	String getText();
+    /**
+     * Returns the text value of this node
+     *
+     * @return
+     */
+    String getText();
 
-	DataHandler getDataHandler();
+    DataHandler getDataHandler();
 
-	/**
-	 *
-	 * @return boolean flag saying whether the node contains
-	 * an optimized text or not
-	 */
-	boolean isOptimized();
-	
-	void doOptimize(boolean value);
+    /**
+     * @return boolean flag saying whether the node contains
+     *         an optimized text or not
+     */
+    boolean isOptimized();
 
-	String getContentID();
+    void doOptimize(boolean value);
+
+    String getContentID();
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMXMLParserWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMXMLParserWrapper.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMXMLParserWrapper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/OMXMLParserWrapper.java Mon Jul 11 08:49:30 2005
@@ -24,6 +24,7 @@
      *
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     int next() throws OMException;
@@ -34,6 +35,7 @@
      *
      * @param el
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     void discard(OMElement el) throws OMException;
@@ -41,6 +43,7 @@
     /**
      * @param b
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     void setCache(boolean b) throws OMException;

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocument.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocument.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocument.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocument.java Mon Jul 11 08:49:30 2005
@@ -30,17 +30,17 @@
      * Field rootElement
      */
     private OMElement rootElement;
-    
+
     /**
      * Field firstChild
      */
     protected OMNode firstChild;
-    
+
     /**
      * Field lastChild
      */
     private OMNode lastChild;
-    
+
     /**
      * Field done
      */
@@ -87,7 +87,7 @@
     public void setRootElement(OMElement rootElement) {
         this.rootElement = rootElement;
     }
-    
+
     /**
      * this will indicate whether parser has parsed this information item completely or not.
      * If somethings info are not available in the item, one has to check this attribute to make sure that, this
@@ -107,12 +107,12 @@
     public void setComplete(boolean state) {
         this.done = state;
     }
-    
+
     /**
      * This will force the parser to proceed, if parser has not yet finished with the XML input
      */
     public void buildNext() {
-        if(!parserWrapper.isCompleted())
+        if (!parserWrapper.isCompleted())
             parserWrapper.next();
     }
 
@@ -125,7 +125,7 @@
     public void addChild(OMNode child) {
         addChild((OMNodeImpl) child);
     }
-    
+
     /**
      * Method addChild
      *
@@ -163,11 +163,12 @@
      * @param elementQName
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public Iterator getChildrenWithName(QName elementQName) throws OMException {
         return new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
-                elementQName);
+                                           elementQName);
     }
 
     /**
@@ -182,7 +183,7 @@
         return firstChild;
     }
 
-	/**
+    /**
      * Method getFirstChildWithName
      *
      * @param elementQName
@@ -192,7 +193,7 @@
     public OMElement getFirstChildWithName(QName elementQName) throws OMException {
         OMChildrenQNameIterator omChildrenQNameIterator =
                 new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
-                        elementQName);
+                                            elementQName);
         OMNode omNode = null;
         if (omChildrenQNameIterator.hasNext()) {
             omNode = (OMNode) omChildrenQNameIterator.next();

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java Mon Jul 11 08:49:30 2005
@@ -147,7 +147,7 @@
         String namespaceURI = qname.getNamespaceURI();
         if (!"".equals(namespaceURI)) {
             ns = findNamespace(qname.getNamespaceURI(),
-                    qname.getPrefix());
+                               qname.getPrefix());
 //        } else {
 //            if (parent != null) {
 //                ns = parent.getNamespace();
@@ -185,7 +185,7 @@
      */
     private OMNamespace handleNamespace(OMNamespace ns) {
         OMNamespace namespace = findNamespace(ns.getName(),
-                ns.getPrefix());
+                                              ns.getPrefix());
         if (namespace == null) {
             namespace = declareNamespace(ns);
         }
@@ -210,11 +210,12 @@
      * @param elementQName
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public Iterator getChildrenWithName(QName elementQName) throws OMException {
         return new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
-                elementQName);
+                                           elementQName);
     }
 
     /**
@@ -227,7 +228,7 @@
     public OMElement getFirstChildWithName(QName elementQName) throws OMException {
         OMChildrenQNameIterator omChildrenQNameIterator =
                 new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
-                        elementQName);
+                                            elementQName);
         OMNode omNode = null;
         if (omChildrenQNameIterator.hasNext()) {
             omNode = (OMNode) omChildrenQNameIterator.next();
@@ -261,6 +262,7 @@
      *
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMNode getNextSibling() throws OMException {
@@ -314,6 +316,7 @@
      * @param prefix
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMNamespace findNamespace(String uri, String prefix)
@@ -389,6 +392,7 @@
      * @param qname
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMAttribute getFirstAttribute(QName qname) throws OMException {
@@ -456,9 +460,9 @@
             namespace = findNamespace(ns.getName(), ns.getPrefix());
             if (namespace == null) {
                 throw new OMException("Given OMNamespace(" + ns.getName() + ns.getPrefix()
-                        + ") for "
-                        + "this attribute is not declared in the scope of this element. First declare the namespace"
-                        + " and then use it with the attribute");
+                                      + ") for "
+                                      + "this attribute is not declared in the scope of this element. First declare the namespace"
+                                      + " and then use it with the attribute");
             }
         }
         return addAttribute(new OMAttributeImpl(attributeName, ns, value));
@@ -514,6 +518,7 @@
      * This will remove this information item and its children, from the model completely
      *
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMNode detach() throws OMException {
@@ -539,6 +544,7 @@
      *
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public int getType() throws OMException {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNamespaceImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNamespaceImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNamespaceImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNamespaceImpl.java Mon Jul 11 08:49:30 2005
@@ -50,8 +50,7 @@
      * @return
      */
     public boolean equals(String uri, String prefix) {
-        return (((prefix == null) && (this.prefix == null)) || ((prefix != null) && prefix.equals(
-                                                                                   this.prefix))) && uri.equals(uri);
+        return (((prefix == null) && (this.prefix == null)) || ((prefix != null) && prefix.equals(this.prefix))) && uri.equals(uri);
     }
 
     /**

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNavigator.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNavigator.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNavigator.java Mon Jul 11 08:49:30 2005
@@ -14,180 +14,180 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- package org.apache.axis2.om.impl.llom;
+package org.apache.axis2.om.impl.llom;
 
 import org.apache.axis2.om.OMContainer;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNode;
 
- /**
-  * Refer to the testClass to find out how to use
-  * features like isNavigable, isComplete and step
-  */
- public class OMNavigator {
-     /**
-      * Field node
-      */
-     protected OMNode node;
-
-     /**
-      * Field visited
-      */
-     private boolean visited;
-
-     /**
-      * Field next
-      */
-     private OMNode next;
-
-     // root is the starting element. Once the navigator comes back to the
-     // root, the traversal is terminated
-
-     /**
-      * Field root
-      */
-     private OMNode root;
-
-     /**
-      * Field backtracked
-      */
-     private boolean backtracked;
-
-     // flags that tell the status of the navigator
-
-     /**
-      * Field end
-      */
-     private boolean end = false;
-
-     /**
-      * Field start
-      */
-     private boolean start = true;
-
-     /**
-      * Constructor OMNavigator
-      */
-     public OMNavigator() {
-     }
-
-     /**
-      * Constructor OMNavigator
-      *
-      * @param node
-      */
-     public OMNavigator(OMNode node) {
-         init(node);
-     }
-
-     /**
-      * Method init
-      *
-      * @param node
-      */
-     public void init(OMNode node) {
-         next = node;
-         root = node;
-         backtracked = false;
-     }
-
-     /**
-      * get the next node
-      *
-      * @return OMnode in the sequence of preorder traversal. Note however that an element node is
-      *         treated slightly diffrently. Once the element is passed it returns the same element in the
-      *         next encounter as well
-      */
-     public OMNode next() {
-         if (next == null) {
-             return null;
-         }
-         node = next;
-         visited = backtracked;
-         backtracked = false;
-         updateNextNode();
-
-         // set the starting and ending flags
-         if (root.equals(node)) {
-             if (!start) {
-                 end = true;
-             } else {
-                 start = false;
-             }
-         }
-         return node;
-     }
-
-     /**
-      * Private method to encapsulate the searching logic
-      */
-     private void updateNextNode() {
-         if ((next instanceof OMElement) && !visited) {
-             OMElementImpl e = (OMElementImpl) next;
-             if (e.firstChild != null) {
-                 next = e.firstChild;
-             } else if (e.isComplete()) {
-                 backtracked = true;
-             } else {
-                 next = null;
-             }
-         } else {
-             OMNode nextSibling = ((OMNodeImpl) next).nextSibling;
-             //OMNode parent = next.getParent();
-             OMContainer parent = next.getParent();
-             if (nextSibling != null) {
-                 next = nextSibling;
-             } else if ((parent != null) && parent.isComplete()) {
-                 next = (OMNodeImpl)parent;
-                 backtracked = true;
-             } else {
-                 next = null;
-             }
-         }
-     }
-
-     /**
-      * Method visited
-      *
-      * @return
-      */
-     public boolean visited() {
-         return visited;
-     }
-
-     /**
-      * This is a very special method. This allows the navigator to step
-      * once it has reached the existing om. At this point the isNavigable
-      * method will return false but the isComplete method may return false
-      * which means that the navigating the given element is not complete but
-      * the navigator cannot proceed
-      */
-     public void step() {
-         if (!end) {
-             next = node;
-             updateNextNode();
-         }
-     }
-
-     /**
-      * the navigable status
-      *
-      * @return
-      */
-     public boolean isNavigable() {
-         if (end) {
-             return false;
-         } else {
-             return !(next == null);
-         }
-     }
-
-     /**
-      * The completed status
-      *
-      * @return
-      */
-     public boolean isCompleted() {
-         return end;
-     }
- }
+/**
+ * Refer to the testClass to find out how to use
+ * features like isNavigable, isComplete and step
+ */
+public class OMNavigator {
+    /**
+     * Field node
+     */
+    protected OMNode node;
+
+    /**
+     * Field visited
+     */
+    private boolean visited;
+
+    /**
+     * Field next
+     */
+    private OMNode next;
+
+    // root is the starting element. Once the navigator comes back to the
+    // root, the traversal is terminated
+
+    /**
+     * Field root
+     */
+    private OMNode root;
+
+    /**
+     * Field backtracked
+     */
+    private boolean backtracked;
+
+    // flags that tell the status of the navigator
+
+    /**
+     * Field end
+     */
+    private boolean end = false;
+
+    /**
+     * Field start
+     */
+    private boolean start = true;
+
+    /**
+     * Constructor OMNavigator
+     */
+    public OMNavigator() {
+    }
+
+    /**
+     * Constructor OMNavigator
+     *
+     * @param node
+     */
+    public OMNavigator(OMNode node) {
+        init(node);
+    }
+
+    /**
+     * Method init
+     *
+     * @param node
+     */
+    public void init(OMNode node) {
+        next = node;
+        root = node;
+        backtracked = false;
+    }
+
+    /**
+     * get the next node
+     *
+     * @return OMnode in the sequence of preorder traversal. Note however that an element node is
+     *         treated slightly diffrently. Once the element is passed it returns the same element in the
+     *         next encounter as well
+     */
+    public OMNode next() {
+        if (next == null) {
+            return null;
+        }
+        node = next;
+        visited = backtracked;
+        backtracked = false;
+        updateNextNode();
+
+        // set the starting and ending flags
+        if (root.equals(node)) {
+            if (!start) {
+                end = true;
+            } else {
+                start = false;
+            }
+        }
+        return node;
+    }
+
+    /**
+     * Private method to encapsulate the searching logic
+     */
+    private void updateNextNode() {
+        if ((next instanceof OMElement) && !visited) {
+            OMElementImpl e = (OMElementImpl) next;
+            if (e.firstChild != null) {
+                next = e.firstChild;
+            } else if (e.isComplete()) {
+                backtracked = true;
+            } else {
+                next = null;
+            }
+        } else {
+            OMNode nextSibling = ((OMNodeImpl) next).nextSibling;
+            //OMNode parent = next.getParent();
+            OMContainer parent = next.getParent();
+            if (nextSibling != null) {
+                next = nextSibling;
+            } else if ((parent != null) && parent.isComplete()) {
+                next = (OMNodeImpl) parent;
+                backtracked = true;
+            } else {
+                next = null;
+            }
+        }
+    }
+
+    /**
+     * Method visited
+     *
+     * @return
+     */
+    public boolean visited() {
+        return visited;
+    }
+
+    /**
+     * This is a very special method. This allows the navigator to step
+     * once it has reached the existing om. At this point the isNavigable
+     * method will return false but the isComplete method may return false
+     * which means that the navigating the given element is not complete but
+     * the navigator cannot proceed
+     */
+    public void step() {
+        if (!end) {
+            next = node;
+            updateNextNode();
+        }
+    }
+
+    /**
+     * the navigable status
+     *
+     * @return
+     */
+    public boolean isNavigable() {
+        if (end) {
+            return false;
+        } else {
+            return !(next == null);
+        }
+    }
+
+    /**
+     * The completed status
+     *
+     * @return
+     */
+    public boolean isCompleted() {
+        return end;
+    }
+}

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java Mon Jul 11 08:49:30 2005
@@ -82,6 +82,7 @@
      *
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMContainer getParent() throws OMException {
@@ -113,6 +114,7 @@
      *
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMNode getNextSibling() throws OMException {
@@ -156,6 +158,7 @@
      * This will remove this information item and its children, from the model completely
      *
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public OMNode detach() throws OMException {
@@ -180,6 +183,7 @@
      *
      * @param sibling
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public void insertSiblingAfter(OMNode sibling) throws OMException {
@@ -206,6 +210,7 @@
      *
      * @param sibling
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public void insertSiblingBefore(OMNode sibling) throws OMException {
@@ -231,6 +236,7 @@
      *
      * @return
      * @throws org.apache.axis2.om.OMException
+     *
      * @throws OMException
      */
     public int getType() throws OMException {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java Mon Jul 11 08:49:30 2005
@@ -27,6 +27,7 @@
 *
 *
 */
+
 public class OMSerializerUtil {
 
     /**
@@ -34,6 +35,7 @@
      *
      * @param writer
      * @throws javax.xml.stream.XMLStreamException
+     *
      */
     static void serializeEndpart(OMOutput omOutput)
             throws XMLStreamException {
@@ -62,10 +64,10 @@
             namespaceName = ns.getName();
             if (prefix != null) {
                 writer.writeAttribute(prefix, namespaceName,
-                        attr.getLocalName(), attr.getValue());
+                                      attr.getLocalName(), attr.getValue());
             } else {
                 writer.writeAttribute(namespaceName, attr.getLocalName(),
-                        attr.getValue());
+                                      attr.getValue());
             }
         } else {
             writer.writeAttribute(attr.getLocalName(), attr.getValue());
@@ -79,9 +81,9 @@
      * @param writer
      * @throws XMLStreamException
      */
-    static void serializeNamespace(OMNamespace namespace,OMOutput omOutput)
+    static void serializeNamespace(OMNamespace namespace, OMOutput omOutput)
             throws XMLStreamException {
-        
+
         if (namespace != null) {
             XMLStreamWriter writer = omOutput.getXmlStreamWriter();
             String uri = namespace.getName();
@@ -101,7 +103,7 @@
      * @param writer
      * @throws XMLStreamException
      */
-    static void serializeStartpart(OMElementImpl element,OMOutput omOutput)
+    static void serializeStartpart(OMElementImpl element, OMOutput omOutput)
             throws XMLStreamException {
         String nameSpaceName = null;
         String writer_prefix = null;
@@ -114,16 +116,16 @@
             if (nameSpaceName != null) {
                 if (writer_prefix != null) {
                     writer.writeStartElement(nameSpaceName,
-                            element.getLocalName());
+                                             element.getLocalName());
                 } else {
                     if (prefix != null) {
                         writer.writeStartElement(prefix, element.getLocalName(),
-                                nameSpaceName);
+                                                 nameSpaceName);
                         writer.writeNamespace(prefix, nameSpaceName);
                         writer.setPrefix(prefix, nameSpaceName);
                     } else {
                         writer.writeStartElement(nameSpaceName,
-                                element.getLocalName());
+                                                 element.getLocalName());
                         writer.writeDefaultNamespace(nameSpaceName);
                         writer.setDefaultNamespace(nameSpaceName);
                     }
@@ -140,7 +142,7 @@
         }
 
         // add the elements attributes
-        serializeAttributes(element,omOutput);
+        serializeAttributes(element, omOutput);
 
         // add the namespaces
         serializeNamespaces(element, omOutput);
@@ -172,29 +174,29 @@
      * @param cache
      * @throws XMLStreamException
      */
-    static void serializeNormal(OMElementImpl element,OMOutput omOutput, boolean cache)
+    static void serializeNormal(OMElementImpl element, OMOutput omOutput, boolean cache)
             throws XMLStreamException {
-        
-        if (cache){
+
+        if (cache) {
             element.build();
         }
 
-        serializeStartpart(element,omOutput);
+        serializeStartpart(element, omOutput);
         OMNode firstChild = element.firstChild;
         if (firstChild != null) {
-            if (cache){
+            if (cache) {
                 firstChild.serializeWithCache(omOutput);
-            }else{
+            } else {
                 firstChild.serialize(omOutput);
             }
         }
         serializeEndpart(omOutput);
     }
 
-    static void serializeByPullStream(OMElementImpl element,OMOutput omOutput) throws XMLStreamException {
-        StreamingOMSerializer streamingOMSerializer =  new StreamingOMSerializer();
+    static void serializeByPullStream(OMElementImpl element, OMOutput omOutput) throws XMLStreamException {
+        StreamingOMSerializer streamingOMSerializer = new StreamingOMSerializer();
         streamingOMSerializer.serialize(element.getXMLStreamReaderWithoutCaching(),
-                omOutput);
+                                        omOutput);
         return;
     }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java Mon Jul 11 08:49:30 2005
@@ -233,7 +233,7 @@
             return parser.hasName();
         } else {
             return ((currentEvent == START_ELEMENT)
-                               || (currentEvent == END_ELEMENT));
+                    || (currentEvent == END_ELEMENT));
         }
     }
 
@@ -278,8 +278,8 @@
      */
     public boolean hasText() {
         return ((currentEvent == CHARACTERS) || (currentEvent == DTD)
-                           || (currentEvent == ENTITY_REFERENCE)
-                           || (currentEvent == COMMENT) || (currentEvent == SPACE));
+                || (currentEvent == ENTITY_REFERENCE)
+                || (currentEvent == COMMENT) || (currentEvent == SPACE));
     }
 
     /**
@@ -394,8 +394,7 @@
         } else {
             if (isStartElement() || isEndElement()
                     || (currentEvent == NAMESPACE)) {
-                OMNamespace ns = (OMNamespace) getItemFromIterator(
-                        ((OMElement) lastNode).getAllDeclaredNamespaces(), i);
+                OMNamespace ns = (OMNamespace) getItemFromIterator(((OMElement) lastNode).getAllDeclaredNamespaces(), i);
                 returnString = (ns == null)
                         ? null
                         : ns.getName();
@@ -416,8 +415,7 @@
         } else {
             if (isStartElement() || isEndElement()
                     || (currentEvent == NAMESPACE)) {
-                OMNamespace ns = (OMNamespace) getItemFromIterator(
-                        ((OMElement) lastNode).getAllDeclaredNamespaces(), i);
+                OMNamespace ns = (OMNamespace) getItemFromIterator(((OMElement) lastNode).getAllDeclaredNamespaces(), i);
                 returnString = (ns == null)
                         ? null
                         : ns.getPrefix();
@@ -438,7 +436,7 @@
             if (isStartElement() || isEndElement()
                     || (currentEvent == NAMESPACE)) {
                 returnCount =
-                getCount(((OMElement) lastNode).getAllDeclaredNamespaces());
+                        getCount(((OMElement) lastNode).getAllDeclaredNamespaces());
             }
         }
         return returnCount;
@@ -458,8 +456,7 @@
 
                 // theres nothing to be returned here
             } else {
-                throw new IllegalStateException(
-                        "attribute type accessed in illegal event!");
+                throw new IllegalStateException("attribute type accessed in illegal event!");
             }
         }
         return returnValue;
@@ -481,8 +478,7 @@
                     returnString = attrib.getValue();
                 }
             } else {
-                throw new IllegalStateException(
-                        "attribute type accessed in illegal event!");
+                throw new IllegalStateException("attribute type accessed in illegal event!");
             }
         }
         return returnString;
@@ -502,8 +498,7 @@
 
                 // todo implement this
             } else {
-                throw new IllegalStateException(
-                        "attribute type accessed in illegal event!");
+                throw new IllegalStateException("attribute type accessed in illegal event!");
             }
         }
         return returnString;
@@ -528,8 +523,7 @@
                     }
                 }
             } else {
-                throw new IllegalStateException(
-                        "attribute prefix accessed in illegal event!");
+                throw new IllegalStateException("attribute prefix accessed in illegal event!");
             }
         }
         return returnString;
@@ -551,8 +545,7 @@
                     returnString = attrib.getLocalName();
                 }
             } else {
-                throw new IllegalStateException(
-                        "attribute localName accessed in illegal event!");
+                throw new IllegalStateException("attribute localName accessed in illegal event!");
             }
         }
         return returnString;
@@ -577,8 +570,7 @@
                     }
                 }
             } else {
-                throw new IllegalStateException(
-                        "attribute nameSpace accessed in illegal event!");
+                throw new IllegalStateException("attribute nameSpace accessed in illegal event!");
             }
         }
         return returnString;
@@ -597,8 +589,7 @@
             if (isStartElement() || (currentEvent == ATTRIBUTE)) {
                 returnQName = getAttribute((OMElement) lastNode, i).getQName();
             } else {
-                throw new IllegalStateException(
-                        "attribute count accessed in illegal event!");
+                throw new IllegalStateException("attribute count accessed in illegal event!");
             }
         }
         return returnQName;
@@ -617,8 +608,7 @@
                 OMElement elt = (OMElement) lastNode;
                 returnCount = getCount(elt.getAttributes());
             } else {
-                throw new IllegalStateException(
-                        "attribute count accessed in illegal event!");
+                throw new IllegalStateException("attribute count accessed in illegal event!");
             }
         }
         return returnCount;
@@ -807,15 +797,13 @@
                 try {
                     parser = (XMLStreamReader) builder.getParser();
                 } catch (Exception e) {
-                    throw new UnsupportedOperationException(
-                            "incompatible parser found!");
+                    throw new UnsupportedOperationException("incompatible parser found!");
                 }
-                log.info(
-                        "Switching to the Real Stax parser to generated the future events");
+                log.info("Switching to the Real Stax parser to generated the future events");
 
-                if ((currentEvent == START_DOCUMENT) && (currentEvent == parser.getEventType())){
+                if ((currentEvent == START_DOCUMENT) && (currentEvent == parser.getEventType())) {
                     currentEvent = parser.next();
-                } else{
+                } else {
                     currentEvent = parser.getEventType();
                 }
                 updateCompleteStatus();
@@ -944,7 +932,7 @@
      */
     public String getVersion() {
 //        throw new UnsupportedOperationException();
-          return "1.0"; //todo put the constant
+        return "1.0"; //todo put the constant
     }
 
 
@@ -954,7 +942,7 @@
      * @return
      */
     public boolean isStandalone() {
-       return true;
+        return true;
     }
 
     /**
@@ -974,7 +962,7 @@
     public String getCharacterEncodingScheme() {
 //        throw new UnsupportedOperationException();
 //        throw new UnsupportedOperationException();
-       return "utf-8";
+        return "utf-8";
     }
 
     /**
@@ -1162,7 +1150,7 @@
         OMAttribute returnAttrib = null;
         if (elt != null) {
             returnAttrib =
-            (OMAttribute) getItemFromIterator(elt.getAttributes(), index);
+                    (OMAttribute) getItemFromIterator(elt.getAttributes(), index);
         }
         return returnAttrib;
     }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java Mon Jul 11 08:49:30 2005
@@ -15,181 +15,166 @@
  */
 package org.apache.axis2.om.impl.llom;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.Random;
-
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
 import org.apache.axis2.attachments.Base64;
 import org.apache.axis2.attachments.ByteArrayDataSource;
 import org.apache.axis2.attachments.IOUtils;
-import org.apache.axis2.om.OMAttribute;
-import org.apache.axis2.om.OMConstants;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMException;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.OMNode;
-import org.apache.axis2.om.OMOutput;
-import org.apache.axis2.om.OMText;
-import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.*;
 import org.apache.axis2.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
 
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.Random;
+
 /**
  * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
  */
 public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
 
-	protected String value = null;
+    protected String value = null;
 
-	protected short textType = TEXT_NODE;
+    protected short textType = TEXT_NODE;
 
-	protected String mimeType;
+    protected String mimeType;
 
-	protected boolean optimize = false;
+    protected boolean optimize = false;
 
-	protected boolean isBinary = false;
-	
-	private static Random rnd = new Random(new Date().getTime());
-
-	/**
-	 * Field contentID for the mime part used when serialising Binary stuff as
-	 * MTOM optimised
-	 */
-	private String contentID = null;
-
-	/**
-	 * Field dataHandler
-	 */
-	private DataHandler dataHandler = null;
-
-	/**
-	 * Field nameSpace used when serialising Binary stuff as MTOM optimised
-	 */
-	protected OMNamespace ns = new OMNamespaceImpl(
-			"http://www.w3.org/2004/08/xop/Include", "xop");
-
-	/**
-	 * Field localName used when serialising Binary stuff as MTOM optimised
-	 */
-	protected String localName = "Include";
-
-	/**
-	 * Field attributes used when serialising Binary stuff as MTOM optimised
-	 */
-	protected OMAttribute attribute;
-
-	/**
-	 * Constructor OMTextImpl
-	 * 
-	 * @param s
-	 */
-	public OMTextImpl(String s) {
-		this.value = s;
-	}
-
-	/**
-	 * Constructor OMTextImpl
-	 * 
-	 * @param parent
-	 * @param text
-	 */
-	public OMTextImpl(OMElement parent, String text) {
-		super(parent);
-		this.value = text;
-		done = true;
-	}
-
-	/**
-	 * @param s -
-	 *            base64 encoded String representation of Binary
-	 * @param mimeType
-	 *            of the Binary
-	 */
-	public OMTextImpl(String s, String mimeType, boolean optimize) {
-		this(null,s,mimeType,optimize);
-	}
-
-	/**
-	 * @param parent
-	 * @param s -
-	 *            base64 encoded String representation of Binary
-	 * @param mimeType
-	 *            of the Binary
-	 */
-	public OMTextImpl(OMElement parent, String s, String mimeType,
-			boolean optimize) {
-		this(parent, s);
-		this.mimeType = mimeType;
-		this.optimize = optimize;
-		if (this.contentID == null && optimize==true) {
-			createContentID();
-		}
+    protected boolean isBinary = false;
+
+    private static Random rnd = new Random(new Date().getTime());
+
+    /**
+     * Field contentID for the mime part used when serialising Binary stuff as
+     * MTOM optimised
+     */
+    private String contentID = null;
+
+    /**
+     * Field dataHandler
+     */
+    private DataHandler dataHandler = null;
+
+    /**
+     * Field nameSpace used when serialising Binary stuff as MTOM optimised
+     */
+    protected OMNamespace ns = new OMNamespaceImpl("http://www.w3.org/2004/08/xop/Include", "xop");
+
+    /**
+     * Field localName used when serialising Binary stuff as MTOM optimised
+     */
+    protected String localName = "Include";
+
+    /**
+     * Field attributes used when serialising Binary stuff as MTOM optimised
+     */
+    protected OMAttribute attribute;
+
+    /**
+     * Constructor OMTextImpl
+     *
+     * @param s
+     */
+    public OMTextImpl(String s) {
+        this.value = s;
+    }
+
+    /**
+     * Constructor OMTextImpl
+     *
+     * @param parent
+     * @param text
+     */
+    public OMTextImpl(OMElement parent, String text) {
+        super(parent);
+        this.value = text;
         done = true;
-	}
+    }
+
+    /**
+     * @param s        -
+     *                 base64 encoded String representation of Binary
+     * @param mimeType of the Binary
+     */
+    public OMTextImpl(String s, String mimeType, boolean optimize) {
+        this(null, s, mimeType, optimize);
+    }
 
-	/**
-	 * @param dataHandler
-	 *            To send binary optimised content Created programatically.
-	 */
-	public OMTextImpl(DataHandler dataHandler) {
-		this(dataHandler,true);
-
-	}
-
-	/**
-	 * @param dataHandler
-	 * @param optimize
-	 *            To send binary content. Created progrmatically.
-	 */
-	public OMTextImpl(DataHandler dataHandler, boolean optimize) {
-		this.dataHandler = dataHandler;
-		this.isBinary = true;
-		this.optimize = optimize;
-		if (this.contentID == null && optimize==true) {
-			createContentID();
-		}
+    /**
+     * @param parent
+     * @param s        -
+     *                 base64 encoded String representation of Binary
+     * @param mimeType of the Binary
+     */
+    public OMTextImpl(OMElement parent, String s, String mimeType,
+                      boolean optimize) {
+        this(parent, s);
+        this.mimeType = mimeType;
+        this.optimize = optimize;
+        if (this.contentID == null && optimize == true) {
+            createContentID();
+        }
         done = true;
+    }
 
-	}
+    /**
+     * @param dataHandler To send binary optimised content Created programatically.
+     */
+    public OMTextImpl(DataHandler dataHandler) {
+        this(dataHandler, true);
+
+    }
+
+    /**
+     * @param dataHandler
+     * @param optimize    To send binary content. Created progrmatically.
+     */
+    public OMTextImpl(DataHandler dataHandler, boolean optimize) {
+        this.dataHandler = dataHandler;
+        this.isBinary = true;
+        this.optimize = optimize;
+        if (this.contentID == null && optimize == true) {
+            createContentID();
+        }
+        done = true;
+
+    }
+
+    /**
+     * @param contentID
+     * @param parent
+     * @param builder   Used when the builder is encountered with a XOP:Include tag
+     *                  Stores a reference to the builder and the content-id. Supports
+     *                  deffered parsing of MIME messages
+     */
+    public OMTextImpl(String contentID, OMElement parent,
+                      OMXMLParserWrapper builder) {
+        super(parent);
+        this.contentID = contentID;
+        this.optimize = true;
+        this.isBinary = true;
+        this.builder = builder;
+//done = true;
+
+    }
 
-	/**
-	 * @param contentID
-	 * @param parent
-	 * @param builder
-	 *            Used when the builder is encountered with a XOP:Include tag
-	 *            Stores a reference to the builder and the content-id. Supports
-	 *            deffered parsing of MIME messages
-	 */
-	public OMTextImpl(String contentID, OMElement parent,
-			OMXMLParserWrapper builder) {
-		super(parent);
-		this.contentID = contentID;
-		this.optimize = true;
-		this.isBinary = true;
-		this.builder = builder;
-        //done = true;
-        
-	}
-
-	/**
-	 * We use the OMText class to hold comments, text, characterData, CData,
-	 * etc., The codes are found in OMNode class
-	 * 
-	 * @param type
-	 */
-	public void setTextType(short type) {
-		if ((type == TEXT_NODE) || (type == COMMENT_NODE)
-				|| (type == CDATA_SECTION_NODE
+    /**
+     * We use the OMText class to hold comments, text, characterData, CData,
+     * etc., The codes are found in OMNode class
+     *
+     * @param type
+     */
+    public void setTextType(short type) {
+        if ((type == TEXT_NODE) || (type == COMMENT_NODE)
+                || (type == CDATA_SECTION_NODE
                 || (type == PI_NODE))) {
-			this.textType = type;
-		} else {
-			throw new UnsupportedOperationException("Attempt to set wrong type");
-		}
-	}
+            this.textType = type;
+        } else {
+            throw new UnsupportedOperationException("Attempt to set wrong type");
+        }
+    }
 
     public int getType() throws OMException {
         int type = super.getType();
@@ -199,280 +184,279 @@
     }
 
     /**
-	 * @param writer
-	 * @throws XMLStreamException
-	 */
-	public void serializeWithCache(OMOutput omOutput) throws XMLStreamException {
-		XMLStreamWriter writer = omOutput.getXmlStreamWriter();
-		if (textType == TEXT_NODE) {
-			writer.writeCharacters(this.value);
-		} else if (textType == COMMENT_NODE) {
-			writer.writeComment(this.value);
-		} else if (textType == CDATA_SECTION_NODE) {
-			writer.writeCData(this.value);
-		}
-		OMNode nextSibling = this.getNextSibling();
-		if (nextSibling != null) {
-			nextSibling.serializeWithCache(omOutput);
-		}
-	}
-
-	/**
-	 * Returns the value
-	 */
-	public String getText() throws OMException {
-		if (this.value != null) {
-			return this.value;
-		} else {
-			try {
-				InputStream inStream;
-				inStream = this.getInputStream();
-				byte[] data;
-				data = new byte[inStream.available()];
-				IOUtils.readFully(inStream, data);
-				return Base64.encode(data);
-			} catch (Exception e) {
-				throw new OMException(
-						"Cannot read from Stream taken form the Data Handler"
-								+ e);
-			}
-		}
-
-	}
-
-	public boolean isOptimized() {
-		return optimize;
-	}
-
-	public void doOptimize(boolean value) {
-		this.optimize = value;
-		if (this.contentID == null && value==true) {
-			getContentID();
-		}
-	}
-
-	/**
-	 * @return
-	 * @throws org.apache.axis2.om.OMException
-	 * @throws OMException
-	 */
-	public DataHandler getDataHandler() {
-
-		/*
-		 * this should return a DataHandler containing the binary data
-		 * reperesented by the Base64 strings stored in OMText
-		 */
-		if (value != null) {
-			ByteArrayDataSource dataSource;
-			byte[] data = Base64.decode(value);
-			if (mimeType != null) {
-				dataSource = new ByteArrayDataSource(data, mimeType);
-			} else {
-				// Assumes type as application/octet-stream
-				dataSource = new ByteArrayDataSource(data);
-			}
-			DataHandler dataHandler = new DataHandler(dataSource);
-			return dataHandler;
-		} else {
-			if (dataHandler == null) {
-				dataHandler = ((MTOMStAXSOAPModelBuilder) builder)
-						.getDataHandler(contentID);
-			}
-			return dataHandler;
-		}
-	}
-
-	public String getLocalName() {
-		return localName;
-	}
-
-	public java.io.InputStream getInputStream() throws OMException {
-		if (isBinary == true) {
-			if (dataHandler == null) {
-				getDataHandler();
-			}
-			InputStream inStream;
-			try {
-				inStream = dataHandler.getDataSource().getInputStream();
-			} catch (IOException e) {
-				throw new OMException(
-						"Cannot get InputStream from DataHandler." + e);
-			}
-			return inStream;
-		} else {
-			throw new OMException("Unsupported Operation");
-		}
-	}
-
-	public String getContentID() {
-		return this.contentID;
-	}
-
-	public boolean isComplete() {
-		return done;
-	}
-
-	public void serialize(OMOutput omOutput) throws XMLStreamException {
-		boolean firstElement = false;
-
-		if (!this.isBinary) {
-			serializeWithCache(omOutput);
-		} else {
-			if (omOutput.doOptimise()) {
-				// send binary as MTOM optimised
-				this.attribute = new OMAttributeImpl("href",
-						new OMNamespaceImpl("", ""), "cid:"
-								+ this.contentID.trim());
-
-				this.serializeStartpart(omOutput);
-				omOutput.writeOptimised(this);
-				omOutput.getXmlStreamWriter().writeEndElement();
-			} else {
-				omOutput.getXmlStreamWriter().writeCharacters(this.getText());
-			}
-			// TODO do we need these
-			OMNode nextSibling = this.getNextSibling();
-			if (nextSibling != null) {
-				// serilize next sibling
-				nextSibling.serialize(omOutput);
-			} else {
-				// TODO : See whether following part is really needed
-				if (parent == null) {
-					return;
-				} else if (parent.isComplete()) {
-					return;
-				} else {
-					// do the special serialization
-					// Only the push serializer is left now
-					builder.next();
-				}
-
-			}
-		}
-
-	}
-	private void createContentID()
-	{
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void serializeWithCache(OMOutput omOutput) throws XMLStreamException {
+        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+        if (textType == TEXT_NODE) {
+            writer.writeCharacters(this.value);
+        } else if (textType == COMMENT_NODE) {
+            writer.writeComment(this.value);
+        } else if (textType == CDATA_SECTION_NODE) {
+            writer.writeCData(this.value);
+        }
+        OMNode nextSibling = this.getNextSibling();
+        if (nextSibling != null) {
+            nextSibling.serializeWithCache(omOutput);
+        }
+    }
+
+    /**
+     * Returns the value
+     */
+    public String getText() throws OMException {
+        if (this.value != null) {
+            return this.value;
+        } else {
+            try {
+                InputStream inStream;
+                inStream = this.getInputStream();
+                byte[] data;
+                data = new byte[inStream.available()];
+                IOUtils.readFully(inStream, data);
+                return Base64.encode(data);
+            } catch (Exception e) {
+                throw new OMException("Cannot read from Stream taken form the Data Handler"
+                                      + e);
+            }
+        }
+
+    }
+
+    public boolean isOptimized() {
+        return optimize;
+    }
+
+    public void doOptimize(boolean value) {
+        this.optimize = value;
+        if (this.contentID == null && value == true) {
+            getContentID();
+        }
+    }
+
+    /**
+     * @return
+     * @throws org.apache.axis2.om.OMException
+     *
+     * @throws OMException
+     */
+    public DataHandler getDataHandler() {
+
+        /*
+         * this should return a DataHandler containing the binary data
+         * reperesented by the Base64 strings stored in OMText
+         */
+        if (value != null) {
+            ByteArrayDataSource dataSource;
+            byte[] data = Base64.decode(value);
+            if (mimeType != null) {
+                dataSource = new ByteArrayDataSource(data, mimeType);
+            } else {
+                // Assumes type as application/octet-stream
+                dataSource = new ByteArrayDataSource(data);
+            }
+            DataHandler dataHandler = new DataHandler(dataSource);
+            return dataHandler;
+        } else {
+            if (dataHandler == null) {
+                dataHandler = ((MTOMStAXSOAPModelBuilder) builder)
+                        .getDataHandler(contentID);
+            }
+            return dataHandler;
+        }
+    }
+
+    public String getLocalName() {
+        return localName;
+    }
+
+    public java.io.InputStream getInputStream() throws OMException {
+        if (isBinary == true) {
+            if (dataHandler == null) {
+                getDataHandler();
+            }
+            InputStream inStream;
+            try {
+                inStream = dataHandler.getDataSource().getInputStream();
+            } catch (IOException e) {
+                throw new OMException("Cannot get InputStream from DataHandler." + e);
+            }
+            return inStream;
+        } else {
+            throw new OMException("Unsupported Operation");
+        }
+    }
+
+    public String getContentID() {
+        return this.contentID;
+    }
+
+    public boolean isComplete() {
+        return done;
+    }
+
+    public void serialize(OMOutput omOutput) throws XMLStreamException {
+        boolean firstElement = false;
+
+        if (!this.isBinary) {
+            serializeWithCache(omOutput);
+        } else {
+            if (omOutput.doOptimise()) {
+                // send binary as MTOM optimised
+                this.attribute = new OMAttributeImpl("href",
+                                                     new OMNamespaceImpl("", ""), "cid:"
+                                                                                  + this.contentID.trim());
+
+                this.serializeStartpart(omOutput);
+                omOutput.writeOptimised(this);
+                omOutput.getXmlStreamWriter().writeEndElement();
+            } else {
+                omOutput.getXmlStreamWriter().writeCharacters(this.getText());
+            }
+            // TODO do we need these
+            OMNode nextSibling = this.getNextSibling();
+            if (nextSibling != null) {
+                // serilize next sibling
+                nextSibling.serialize(omOutput);
+            } else {
+                // TODO : See whether following part is really needed
+                if (parent == null) {
+                    return;
+                } else if (parent.isComplete()) {
+                    return;
+                } else {
+                    // do the special serialization
+                    // Only the push serializer is left now
+                    builder.next();
+                }
+
+            }
+        }
+
+    }
+
+    private void createContentID() {
 //		 We can use a UUID, taken using Apache commons id project.
-		// TODO change to UUID
-		this.contentID = "2"+String.valueOf(rnd.nextLong())+"@schemas.xmlsoap.org";
-	}
+        // TODO change to UUID
+        this.contentID = "2" + String.valueOf(rnd.nextLong()) + "@schemas.xmlsoap.org";
+    }
 
 
-	/*
-	 * Methods to copy from OMSerialize utils
-	 */
-	private void serializeStartpart(OMOutput omOutput)
-			throws XMLStreamException {
-		String nameSpaceName = null;
-		String writer_prefix = null;
-		String prefix = null;
-		XMLStreamWriter writer = omOutput.getXmlStreamWriter();
-		if (this.ns != null) {
+    /*
+     * Methods to copy from OMSerialize utils
+     */
+    private void serializeStartpart(OMOutput omOutput)
+            throws XMLStreamException {
+        String nameSpaceName = null;
+        String writer_prefix = null;
+        String prefix = null;
+        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+        if (this.ns != null) {
             nameSpaceName = this.ns.getName();
             writer_prefix = writer.getPrefix(nameSpaceName);
             prefix = this.ns.getPrefix();
-          
+
             if (nameSpaceName != null) {
                 if (writer_prefix != null) {
                     writer.writeStartElement(nameSpaceName,
-                            this.getLocalName());
+                                             this.getLocalName());
                 } else {
                     if (prefix != null) {
                         writer.writeStartElement(prefix, this.getLocalName(),
-                                nameSpaceName);
-                        //TODO FIX ME
-                        //writer.writeNamespace(prefix, nameSpaceName);
+                                                 nameSpaceName);
+//TODO FIX ME
+//writer.writeNamespace(prefix, nameSpaceName);
                         writer.setPrefix(prefix, nameSpaceName);
                     } else {
                         writer.writeStartElement(nameSpaceName,
-                                this.getLocalName());
+                                                 this.getLocalName());
                         writer.writeDefaultNamespace(nameSpaceName);
                         writer.setDefaultNamespace(nameSpaceName);
                     }
                 }
             } else {
-				writer.writeStartElement(this.getLocalName());
+                writer.writeStartElement(this.getLocalName());
+
+            }
+        } else {
+            writer.writeStartElement(this.getLocalName());
+
+        }
+
+        // add the elements attribute "href"
+
+        serializeAttribute(this.attribute, omOutput);
 
-			}
-		} else {
-			writer.writeStartElement(this.getLocalName());
-
-		}
-
-		// add the elements attribute "href"
-		
-		serializeAttribute(this.attribute, omOutput);
-
-		// add the namespace
-		serializeNamespace(this.ns, omOutput);
-
-	}
-
-	/**
-	 * Method serializeAttribute
-	 * 
-	 * @param attr
-	 * @param writer
-	 * @throws XMLStreamException
-	 */
-	static void serializeAttribute(OMAttribute attr, OMOutput omOutput)
-			throws XMLStreamException {
-
-		XMLStreamWriter writer = omOutput.getXmlStreamWriter();
-		// first check whether the attribute is associated with a namespace
-		OMNamespace ns = attr.getNamespace();
-		String prefix = null;
-		String namespaceName = null;
-		if (ns != null) {
-
-			// add the prefix if it's availble
-			prefix = ns.getPrefix();
-			namespaceName = ns.getName();
-			if (prefix != null) {
-				writer.writeAttribute(prefix, namespaceName, attr
-						.getLocalName(), attr.getValue());
-			} else {
-				writer.writeAttribute(namespaceName, attr.getLocalName(), attr
-						.getValue());
-			}
-		} else {
-			writer.writeAttribute(attr.getLocalName(), attr.getValue());
-		}
-	}
-
-	/**
-	 * Method serializeNamespace
-	 * 
-	 * @param namespace
-	 * @param writer
-	 * @throws XMLStreamException
-	 */
-	static void serializeNamespace(OMNamespace namespace, OMOutput omOutput)
-			throws XMLStreamException {
-		XMLStreamWriter writer = omOutput.getXmlStreamWriter();
-		if (namespace != null) {
-			String uri = namespace.getName();
-			//String prefix = writer.getPrefix(uri);
-			String ns_prefix = namespace.getPrefix();
-			//if (prefix == null) {
-				writer.writeNamespace(ns_prefix, namespace.getName());
-				writer.setPrefix(ns_prefix, uri);
-			//}
-		}
-	}
-
-	/**
-	 * Slightly different implementation of the discard method
-	 * 
-	 * @throws OMException
-	 */
-	public void discard() throws OMException {
-		if (done) {
-			this.detach();
-		} else {
-			builder.discard((OMElement) this.parent);
-		}
-	}
+        // add the namespace
+        serializeNamespace(this.ns, omOutput);
+
+    }
+
+    /**
+     * Method serializeAttribute
+     *
+     * @param attr
+     * @param writer
+     * @throws XMLStreamException
+     */
+    static void serializeAttribute(OMAttribute attr, OMOutput omOutput)
+            throws XMLStreamException {
+
+        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+        // first check whether the attribute is associated with a namespace
+        OMNamespace ns = attr.getNamespace();
+        String prefix = null;
+        String namespaceName = null;
+        if (ns != null) {
+
+            // add the prefix if it's availble
+            prefix = ns.getPrefix();
+            namespaceName = ns.getName();
+            if (prefix != null) {
+                writer.writeAttribute(prefix, namespaceName, attr
+                                                             .getLocalName(), attr.getValue());
+            } else {
+                writer.writeAttribute(namespaceName, attr.getLocalName(), attr
+                                                                          .getValue());
+            }
+        } else {
+            writer.writeAttribute(attr.getLocalName(), attr.getValue());
+        }
+    }
+
+    /**
+     * Method serializeNamespace
+     *
+     * @param namespace
+     * @param writer
+     * @throws XMLStreamException
+     */
+    static void serializeNamespace(OMNamespace namespace, OMOutput omOutput)
+            throws XMLStreamException {
+        XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+        if (namespace != null) {
+            String uri = namespace.getName();
+            //String prefix = writer.getPrefix(uri);
+            String ns_prefix = namespace.getPrefix();
+            //if (prefix == null) {
+            writer.writeNamespace(ns_prefix, namespace.getName());
+            writer.setPrefix(ns_prefix, uri);
+            //}
+        }
+    }
+
+    /**
+     * Slightly different implementation of the discard method
+     *
+     * @throws OMException
+     */
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard((OMElement) this.parent);
+        }
+    }
 
 }



Mime
View raw message