You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by th...@apache.org on 2005/06/23 16:36:17 UTC

svn commit: r193150 - /webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java

Author: thilina
Date: Thu Jun 23 07:36:16 2005
New Revision: 193150

URL: http://svn.apache.org/viewcvs?rev=193150&view=rev
Log: (empty)

Modified:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java?rev=193150&r1=193149&r2=193150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java Thu Jun 23 07:36:16 2005
@@ -36,7 +36,6 @@
 import org.apache.axis.om.OMText;
 import org.apache.axis.om.OMXMLParserWrapper;
 import org.apache.axis.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
-import org.apache.axis.om.impl.llom.mtom.MTOMXMLStreamWriter;
 
 /**
  * Class OMTextImpl
@@ -179,8 +178,9 @@
 	 * @param writer
 	 * @throws XMLStreamException
 	 */
-	public void serializeWithCache(XMLStreamWriter writer)
+	public void serializeWithCache(OMOutputer outputer)
 			throws XMLStreamException {
+		XMLStreamWriter writer = outputer.getXmlStreamWriter();
 		if (textType == TEXT_NODE) {
 			writer.writeCharacters(this.value);
 		} else if (textType == COMMENT_NODE) {
@@ -190,7 +190,7 @@
 		}
 		OMNode nextSibling = this.getNextSibling();
 		if (nextSibling != null) {
-			nextSibling.serializeWithCache(writer);
+			nextSibling.serializeWithCache(outputer);
 		}
 	}
 
@@ -284,31 +284,30 @@
 		return true;
 	}
 
-	public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+	public void serialize(OMOutputer outputer) throws XMLStreamException {
 		boolean firstElement = false;
 
 		if (!this.isBinary) {
-			serializeWithCache(writer);
+			serializeWithCache(outputer);
 		} else {
-			if (writer instanceof MTOMXMLStreamWriter) {
+			if (outputer.doOptimise()) {
 				// send binary as MTOM optimised
-				MTOMXMLStreamWriter mtomWriter = (MTOMXMLStreamWriter) writer;
 				this.attribute = new OMAttributeImpl("href",
 						new OMNamespaceImpl("", ""), "cid:"
 								+ this.contentID.trim());
 
-				this.serializeStartpart(mtomWriter);
-				mtomWriter.writeOptimised(this);
-				mtomWriter.writeEndElement();
+				this.serializeStartpart(outputer);
+				outputer.writeOptimised(this);
+				outputer.getXmlStreamWriter().writeEndElement();
 			} else {
 
-				writer.writeCharacters(this.getText());
+				outputer.getXmlStreamWriter().writeCharacters(this.getText());
 			}
 
 			OMNode nextSibling = this.getNextSibling();
 			if (nextSibling != null) {
 				// serilize next sibling
-				nextSibling.serialize(writer);
+				nextSibling.serialize(outputer);
 			} else {
 				// TODO : See whether following part is really needed
 				if (parent == null) {
@@ -329,11 +328,12 @@
 	/*
 	 * Methods to copy from OMSerialize utils
 	 */
-	private void serializeStartpart(XMLStreamWriter writer)
+	private void serializeStartpart( OMOutputer outputer)
 			throws XMLStreamException {
 		String nameSpaceName = null;
 		String writer_prefix = null;
 		String prefix = null;
+		XMLStreamWriter writer = outputer.getXmlStreamWriter();
 		if (this.ns != null) {
 			nameSpaceName = this.ns.getName();
 			writer_prefix = writer.getPrefix(nameSpaceName);
@@ -366,10 +366,10 @@
 		}
 
 		// add the elements attribute "href"
-		serializeAttribute(this.attribute, writer);
+		serializeAttribute(this.attribute, outputer);
 
 		// add the namespace
-		serializeNamespace(this.ns, writer);
+		serializeNamespace(this.ns, outputer);
 
 	}
 
@@ -380,9 +380,10 @@
 	 * @param writer
 	 * @throws XMLStreamException
 	 */
-	static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)
+	static void serializeAttribute(OMAttribute attr, OMOutputer outputer)
 			throws XMLStreamException {
 
+		XMLStreamWriter writer = outputer.getXmlStreamWriter();
 		// first check whether the attribute is associated with a namespace
 		OMNamespace ns = attr.getNamespace();
 		String prefix = null;
@@ -411,8 +412,9 @@
 	 * @param writer
 	 * @throws XMLStreamException
 	 */
-	static void serializeNamespace(OMNamespace namespace, XMLStreamWriter writer)
+	static void serializeNamespace(OMNamespace namespace, OMOutputer outputer)
 			throws XMLStreamException {
+		XMLStreamWriter writer = outputer.getXmlStreamWriter();
 		if (namespace != null) {
 			String uri = namespace.getName();
 			String prefix = writer.getPrefix(uri);