You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/11/30 06:19:54 UTC
svn commit: r349881 - in /webservices/axis2/trunk/java/modules:
core/src/org/apache/axis2/deployment/
integration/itest/org/apache/axis2/rest/
integration/src/test/soap12testing/client/
integration/test/org/apache/axis2/groovy/ saaj/src/org/apache/axis...
Author: dims
Date: Tue Nov 29 21:19:30 2005
New Revision: 349881
URL: http://svn.apache.org/viewcvs?rev=349881&view=rev
Log:
- s/ignoreXMLDeclaration/setIgnoreXMLDeclaration/
- Add helper methods in OMNode and OMDocument to make easy cases easy (write to a OutputStream/Writer)
- Cleanup instances where the helpers can be used. Avoid OMOutputImpl as much as possible.
TODO:
- Review remaining usage of OMOutputImpl.
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java
webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java
webservices/axis2/trunk/java/modules/integration/src/test/soap12testing/client/MessageComparator.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/NodeImpl.java
webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java
webservices/axis2/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java
webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
webservices/axis2/trunk/java/modules/samples/src/userguide/clients/EchoBlockingWsaBasedClient.java
webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMDocument.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocumentImpl.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/AbstractOMSerializationTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMBlankElementTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/OMBlankElementTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMDocumentSerilizationTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java
webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceUnit.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Tue Nov 29 21:19:30 2005
@@ -31,12 +31,10 @@
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.om.OMAttribute;
import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.impl.WSDLOperationImpl;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import java.io.InputStream;
import java.io.StringWriter;
@@ -85,8 +83,7 @@
if (descriptionValue != null) {
StringWriter writer = new StringWriter();
descriptionValue.build();
- descriptionValue.serialize(new
- OMOutputImpl(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)));
+ descriptionValue.serialize(writer);
writer.flush();
service.setAxisServiceName(writer.toString());
} else {
Modified: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/GetTest.java Tue Nov 29 21:19:30 2005
@@ -22,14 +22,11 @@
import org.apache.axis2.client.Call;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
public class GetTest extends TestCase implements TestConstants {
@@ -63,9 +60,7 @@
//if post is through GET of HTTP
OMElement response = call.invokeBlocking("webSearch", data);
- XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- response.serialize(new OMOutputImpl(writer));
- writer.flush();
+ response.serialize(System.out);
}
}
Modified: webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/itest/org/apache/axis2/rest/RESTGetTest.java Tue Nov 29 21:19:30 2005
@@ -7,21 +7,16 @@
package org.apache.axis2.rest;
import junit.framework.TestCase;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Call;
import org.apache.axis2.engine.util.TestConstants;
import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
//This Sample test Client is written for Yahoo Web Search
@@ -58,8 +53,6 @@
//if post is through GET of HTTP
OMElement response = call.invokeBlocking("webSearch", data);
- XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- response.serialize(new OMOutputImpl(writer));
- writer.flush();
+ response.serialize(System.out);
}
}
Modified: webservices/axis2/trunk/java/modules/integration/src/test/soap12testing/client/MessageComparator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/src/test/soap12testing/client/MessageComparator.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/src/test/soap12testing/client/MessageComparator.java (original)
+++ webservices/axis2/trunk/java/modules/integration/src/test/soap12testing/client/MessageComparator.java Tue Nov 29 21:19:30 2005
@@ -18,7 +18,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.om.OMXMLParserWrapper;
-import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.om.impl.llom.exception.XMLComparisonException;
import org.apache.axis2.soap.SOAPEnvelope;
import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
@@ -62,14 +61,10 @@
soapComparator.addIgnorableNamespace("http://schemas.xmlsoap.org/ws/2004/08/addressing");
System.out.println("######################################################");
- OMOutputImpl omOutput = new OMOutputImpl(System.out,false);
- requiredMessageEnvelope.serialize(omOutput);
- omOutput.flush();
+ requiredMessageEnvelope.serialize(System.out);
System.out.println("");
System.out.println("-------------------------------------------------------");
- OMOutputImpl omOutput1 = new OMOutputImpl(System.out,false);
- replyMessageEnvelope.serialize(omOutput1);
- omOutput1.flush();
+ replyMessageEnvelope.serialize(System.out);
System.out.println("");
System.out.println("`######################################################");
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/groovy/GroovyServiceTest.java Tue Nov 29 21:19:30 2005
@@ -25,13 +25,11 @@
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
import org.apache.axis2.soap.SOAPFactory;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.ByteArrayInputStream;
@@ -98,7 +96,7 @@
StringWriter writer = new StringWriter();
result.build();
- result.serialize(new OMOutputImpl(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)));
+ result.serialize(writer);
writer.flush();
call.close();
}
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/NodeImpl.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/NodeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/NodeImpl.java Tue Nov 29 21:19:30 2005
@@ -17,6 +17,7 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLOutputFactory;
import org.apache.axis2.om.OMContainer;
import org.apache.axis2.om.OMException;
@@ -31,17 +32,20 @@
import org.w3c.dom.NodeList;
import org.w3c.dom.UserDataHandler;
+import java.io.OutputStream;
+import java.io.Writer;
+
/**
* @author Ruchith Fernando (ruchith.fernando@gmail.com)
*/
public abstract class NodeImpl implements Node, NodeList,OMNodeEx {
-
+
/**
* Field builder
*/
protected OMXMLParserWrapper builder;
-
+
/**
* Field done
*/
@@ -51,12 +55,12 @@
* Field nodeType
*/
protected int nodeType;
-
-
-
-
- protected DocumentImpl ownerNode;
-
+
+
+
+
+ protected DocumentImpl ownerNode;
+
// data
protected short flags;
@@ -65,16 +69,16 @@
protected final static short READONLY = 0x1<<3;
protected final static short SPECIFIED = 0x1<<4;
protected final static short NORMALIZED = 0x1<<5;
-
+
//
// Constructors
//
protected NodeImpl(DocumentImpl ownerDocument) {
-
+
this.ownerNode = ownerDocument;
// this.isOwned(true);
-
+
}
protected NodeImpl() {
@@ -83,8 +87,8 @@
public void normalize() {
- /* by default we do not have any children,
- ParentNode overrides this behavior */
+ /* by default we do not have any children,
+ ParentNode overrides this behavior */
}
@@ -96,50 +100,50 @@
public boolean hasChildNodes() {
return false; //Override in ParentNode
}
-
-
+
+
public String getLocalName()
{
return null; //Override in AttrImpl and ElementImpl
}
public String getNamespaceURI() {
- return null; //Override in AttrImpl and ElementImpl
- }
+ return null; //Override in AttrImpl and ElementImpl
+ }
+
-
- public String getNodeValue() throws DOMException {
- return null;
- }
+ public String getNodeValue() throws DOMException {
+ return null;
+ }
-
- /*
- * Overidden in ElementImpl and AttrImpl
- */
+
+ /*
+ * Overidden in ElementImpl and AttrImpl
+ */
public String getPrefix()
{
return null;
}
- public void setNodeValue(String arg0) throws DOMException {
- //Don't do anything, to be overridden in SOME Child classes
- }
+ public void setNodeValue(String arg0) throws DOMException {
+ //Don't do anything, to be overridden in SOME Child classes
+ }
public void setPrefix(String prefix) throws DOMException {
- throw new DOMException(DOMException.NAMESPACE_ERR,
+ throw new DOMException(DOMException.NAMESPACE_ERR,
DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
"NAMESPACE_ERR", null));
}
-
+
/**
* Find the Document that this Node belongs to (the document in
* whose context the Node was created). The Node may or may not
*/
public Document getOwnerDocument() {
- return (Document) this.ownerNode;
+ return (Document) this.ownerNode;
}
/**
@@ -150,7 +154,7 @@
* @see ElementImpl
*/
public NamedNodeMap getAttributes() {
- return null; // overridden in ElementImpl
+ return null; // overridden in ElementImpl
}
/** The first child of this Node, or null if none.
@@ -159,7 +163,7 @@
* @see ParentNode
*/
public Node getFirstChild() {
- return null;
+ return null;
}
@@ -169,7 +173,7 @@
* @see ParentNode
*/
public Node getLastChild() {
- return null;
+ return null;
}
/** The next child of this node's parent, or null if none */
@@ -189,93 +193,93 @@
NodeImpl parentNode() {
return null;
}
-
+
/** The previous child of this node's parent, or null if none */
public Node getPreviousSibling() {
return null; // default behavior, overriden in ChildNode
}
-
+
public Node cloneNode(boolean deep) {
- NodeImpl newnode;
- try {
+ NodeImpl newnode;
+ try {
newnode = (NodeImpl)clone();
- }
- catch (CloneNotSupportedException e) {
+ }
+ catch (CloneNotSupportedException e) {
throw new RuntimeException("**Internal Error**" + e);
- }
- newnode.ownerNode = this.ownerNode;
+ }
+ newnode.ownerNode = this.ownerNode;
newnode.isOwned(false);
-
+
newnode.isReadonly(false);
-
+
return newnode;
- }
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.w3c.dom.Node#getChildNodes()
- */
- public NodeList getChildNodes() {
- return this;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.w3c.dom.Node#getChildNodes()
+ */
+ public NodeList getChildNodes() {
+ return this;
+ }
public boolean isSupported(String feature, String version)
{
- throw new UnsupportedOperationException();
- //TODO
+ throw new UnsupportedOperationException();
+ //TODO
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
+ */
+ public Node appendChild(Node newChild) throws DOMException {
+ return insertBefore(newChild, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
+ */
+ public Node removeChild(Node oldChild) throws DOMException {
+ throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter
+ .formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
+ null));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
+ */
+ public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+ //Overridden in ParentNode
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
+ */
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
- */
- public Node appendChild(Node newChild) throws DOMException {
- return insertBefore(newChild, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
- */
- public Node removeChild(Node oldChild) throws DOMException {
- throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter
- .formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
- null));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
- */
- public Node insertBefore(Node newChild, Node refChild) throws DOMException {
- //Overridden in ParentNode
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
- */
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
- }
-
//
// NodeList methods
//
@@ -289,7 +293,7 @@
* @return int
*/
public int getLength() {
- return 0;
+ return 0;
}
/**
@@ -303,15 +307,15 @@
* @param Index int
*/
public Node item(int index) {
- return null;
+ return null;
}
-
-
-
+
+
+
/*
- * Flags setters and getters
- */
+ * Flags setters and getters
+ */
final boolean isOwned() {
@@ -337,7 +341,7 @@
final void isReadonly(boolean value) {
flags = (short) (value ? flags | READONLY : flags & ~READONLY);
}
-
+
final boolean isSpecified() {
return (flags & SPECIFIED) != 0;
}
@@ -345,7 +349,7 @@
final void isSpecified(boolean value) {
flags = (short) (value ? flags | SPECIFIED : flags & ~SPECIFIED);
}
-
+
final boolean isNormalized() {
return (flags & NORMALIZED) != 0;
}
@@ -362,111 +366,111 @@
///OM Methods
///
- /* (non-Javadoc)
- * @see org.apache.axis.om.OMNode#getParent()
- */
- public OMContainer getParent() throws OMException {
- return null; // overriden by ChildNode
+ /* (non-Javadoc)
+ * @see org.apache.axis.om.OMNode#getParent()
+ */
+ public OMContainer getParent() throws OMException {
+ return null; // overriden by ChildNode
//Document, DocumentFragment, and Attribute will never have parents.
- }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.om.OMNode#isComplete()
+ */
+ public boolean isComplete() {
+ return this.done;
+ }
+
+ public void setComplete(boolean state) {
+ this.done = state;
+
+ }
+
+ /**
+ * There no concept of caching in this OM-DOM implementation
+ */
+ public void serializeWithCache(OMOutputImpl omOutput) throws XMLStreamException {
+ this.serialize(omOutput);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.om.OMNode#insertSiblingAfter(org.apache.axis.om.OMNode)
+ */
+ public void insertSiblingAfter(OMNode sibling) throws OMException {
+ //Overridden in ChildNode
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.axis.om.OMNode#insertSiblingBefore(org.apache.axis.om.OMNode)
+ */
+ public void insertSiblingBefore(OMNode sibling) throws OMException {
+ //Overridden in ChildNode
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
+
+ }
+
+
+
+ /**
+ * default behavior, overriden in ChildNode
+ */
+ public OMNode getPreviousOMSibling() {
+ return null;
+ }
+
+ /**
+ * default behavior, overriden in ChildNode
+ */
+ public OMNode getNextOMSibling() {
+ return null;
+ }
+
+ public void setPreviousOMSibling(OMNode previousSibling) {
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
+ }
+
+ public void setNextOMSibling(OMNode previousSibling) {
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
+ }
+
+ /**
+ * Build next element
+ * @see org.apache.axis.om.OMNode#build()
+ */
+ public void build() {
+ while (!done)
+ this.builder.next();
+ }
+
+ /**
+ * sets the owner document
+ * @param document
+ */
+ protected void setOwnerDocument(DocumentImpl document) {
+ this.ownerNode = document;
+ this.isOwned(true);
+ }
- /* (non-Javadoc)
- * @see org.apache.axis.om.OMNode#isComplete()
- */
- public boolean isComplete() {
- return this.done;
- }
-
- public void setComplete(boolean state) {
- this.done = state;
-
- }
-
- /**
- * There no concept of caching in this OM-DOM implementation
- */
- public void serializeWithCache(OMOutputImpl omOutput) throws XMLStreamException {
- this.serialize(omOutput);
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis.om.OMNode#insertSiblingAfter(org.apache.axis.om.OMNode)
- */
- public void insertSiblingAfter(OMNode sibling) throws OMException {
- //Overridden in ChildNode
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.axis.om.OMNode#insertSiblingBefore(org.apache.axis.om.OMNode)
- */
- public void insertSiblingBefore(OMNode sibling) throws OMException {
- //Overridden in ChildNode
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
-
- }
-
-
-
- /**
- * default behavior, overriden in ChildNode
- */
- public OMNode getPreviousOMSibling() {
- return null;
- }
-
- /**
- * default behavior, overriden in ChildNode
- */
- public OMNode getNextOMSibling() {
- return null;
- }
-
- public void setPreviousOMSibling(OMNode previousSibling) {
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
- }
-
- public void setNextOMSibling(OMNode previousSibling) {
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
- }
-
- /**
- * Build next element
- * @see org.apache.axis.om.OMNode#build()
- */
- public void build() {
- while (!done)
- this.builder.next();
- }
-
- /**
- * sets the owner document
- * @param document
- */
- protected void setOwnerDocument(DocumentImpl document) {
- this.ownerNode = document;
- this.isOwned(true);
- }
-
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
OMOutputImpl omOutput = new OMOutputImpl(xmlWriter);
serialize(omOutput);
omOutput.flush();
}
-
+
public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException {
OMOutputImpl omOutput = new OMOutputImpl(xmlWriter);
serializeAndConsume(omOutput);
@@ -474,73 +478,87 @@
}
public OMNode detach() {
- throw new OMException(
+ throw new OMException(
"Elements that doesn't have a parent can not be detached");
}
-
- /*
- * DOM-Level 3 methods
- */
-
- public String getBaseURI() {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public short compareDocumentPosition(Node arg0) throws DOMException {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public String getTextContent() throws DOMException {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public void setTextContent(String arg0) throws DOMException {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public boolean isSameNode(Node arg0) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public String lookupPrefix(String arg0) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public boolean isDefaultNamespace(String arg0) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public String lookupNamespaceURI(String arg0) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public boolean isEqualNode(Node arg0) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public Object getFeature(String arg0, String arg1) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public Object setUserData(String arg0, Object arg1, UserDataHandler arg2) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
- public Object getUserData(String arg0) {
- // TODO TODO
- throw new UnsupportedOperationException("TODO");
- }
-
+ /*
+ * DOM-Level 3 methods
+ */
+
+ public String getBaseURI() {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public short compareDocumentPosition(Node arg0) throws DOMException {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public String getTextContent() throws DOMException {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public void setTextContent(String arg0) throws DOMException {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public boolean isSameNode(Node arg0) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public String lookupPrefix(String arg0) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public boolean isDefaultNamespace(String arg0) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public String lookupNamespaceURI(String arg0) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public boolean isEqualNode(Node arg0) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public Object getFeature(String arg0, String arg1) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public Object setUserData(String arg0, Object arg1, UserDataHandler arg2) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public Object getUserData(String arg0) {
+ // TODO TODO
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ public void serialize(OutputStream output) throws XMLStreamException {
+ serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(output));
+ }
+
+ public void serialize(Writer writer) throws XMLStreamException {
+ serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+ }
+
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException {
+ serializeAndConsume(XMLOutputFactory.newInstance().createXMLStreamWriter(output));
+ }
+
+ public void serializeAndConsume(Writer writer) throws XMLStreamException {
+ serializeAndConsume(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+ }
}
Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java Tue Nov 29 21:19:30 2005
@@ -247,7 +247,7 @@
output.setCharSetEncoding((String)getProperty(CHARACTER_SET_ENCODING));
String writeXmlDecl = (String)getProperty(WRITE_XML_DECLARATION);
if(writeXmlDecl==null || writeXmlDecl.equals("false")) { //SAAJ default case doesn't send XML decl
- output.ignoreXMLDeclaration(true);
+ output.setIgnoreXMLDeclaration(true);
}
output.setOutputStream(out, false);
//the writeTo method forces the elements to be built!!!
Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/om/impl/dom/ElementImplTest.java Tue Nov 29 21:19:30 2005
@@ -71,9 +71,7 @@
((Text)textNode).appendData(textToAppend);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
- OMOutputImpl output = new OMOutputImpl(baos, false);
- elem.serialize(output);
- output.flush();
+ elem.serialize(baos);
System.out.println(new String(baos.toByteArray()));
//TODO TEMPORARY: remove this
} catch (Exception e) {
Modified: webservices/axis2/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java Tue Nov 29 21:19:30 2005
@@ -29,7 +29,6 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.impl.OMOutputImpl;
import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
import org.apache.axis2.soap.SOAPEnvelope;
@@ -84,10 +83,7 @@
inMessage.getEnvelope().build();
StringWriter writer = new StringWriter();
firstChild.build();
- firstChild.serialize(
- new OMOutputImpl(
- XMLOutputFactory.newInstance().createXMLStreamWriter(
- writer)));
+ firstChild.serialize(writer);
writer.flush();
String value = writer.toString();
if (value != null) {
Modified: webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java (original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/yahooservices/RESTSearch/RESTSearchClient.java Tue Nov 29 21:19:30 2005
@@ -4,10 +4,6 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.RESTCall;
import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.OMOutputImpl;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
public class RESTSearchClient {
public static void main(String[] args) {
@@ -23,9 +19,7 @@
//if post is through GET of HTTP
OMElement response = call.invokeBlocking();
- XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- response.serialize(new OMOutputImpl(writer));
- writer.flush();
+ response.serialize(System.out);
}catch(Exception e){
e.printStackTrace();
Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/clients/EchoBlockingWsaBasedClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/clients/EchoBlockingWsaBasedClient.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/clients/EchoBlockingWsaBasedClient.java (original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/clients/EchoBlockingWsaBasedClient.java Tue Nov 29 21:19:30 2005
@@ -22,9 +22,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.impl.OMOutputImpl;
-import javax.xml.stream.XMLOutputFactory;
import java.io.StringWriter;
/**
@@ -55,9 +53,7 @@
OMElement result = (OMElement) call.invokeBlocking("echo", getBody());
StringWriter writer = new StringWriter();
- result.serialize(new OMOutputImpl(
- XMLOutputFactory.newInstance().createXMLStreamWriter(
- writer)));
+ result.serialize(writer);
writer.flush();
System.out.println(writer.toString());
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/util/Axis2Util.java Tue Nov 29 21:19:30 2005
@@ -58,9 +58,7 @@
* There are plans to deprecate the OmNode.serializeAndConsume(XMLStreamWriter)
* method therefore using OMOutoutImpl to serializeAndConsume the env
*/
- OMOutputImpl output = new OMOutputImpl(baos, false);
- env.serialize(output);
- output.flush();
+ env.serialize(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
@@ -227,9 +225,7 @@
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputImpl output = new OMOutputImpl(baos, false);
- element.serialize(output);
- output.flush();
+ element.serialize(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMDocument.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMDocument.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMDocument.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMDocument.java Tue Nov 29 21:19:30 2005
@@ -19,94 +19,92 @@
import org.apache.axis2.om.impl.OMOutputImpl;
import javax.xml.stream.XMLStreamException;
+import java.io.OutputStream;
public interface OMDocument extends OMContainer {
- /**
- * Field XML_10 XML Version 1.0
- */
- public final static String XML_10 = "1.0";
-
- /**
- * Field XML_11 XML Version 1.1
- */
- public final static String XML_11 = "1.1";
-
- /**
- * Returns the document element
- * @return
- */
- public OMElement getOMDocumentElement();
-
- /**
- * Sets the document element of the XML document
- * @param rootElement
- */
- public void setOMDocumentElement(OMElement rootElement);
-
- /**
- * Returns the XML version
- * @return
- */
- public String getXMLVersion();
-
- /**
- * Sets the XML version
- * @see org.apache.axis2.om.impl.llom.OMDocumentImpl#XML_10 XML 1.0
- * @see org.apache.axis2.om.impl.llom.OMDocumentImpl#XML_11 XML 1.1
- * @param version
- */
- public void setXMLVersion(String version);
-
- /**
- * Returns the caracter set encoding scheme
- * @return
- */
- public String getCharsetEncoding();
-
- /**
- * Sets the character set encoding scheme to be used
- * @param charsetEncoding
- */
- public void setCharsetEncoding(String charsetEncoding);
+ /**
+ * Field XML_10 XML Version 1.0
+ */
+ public final static String XML_10 = "1.0";
+
+ /**
+ * Field XML_11 XML Version 1.1
+ */
+ public final static String XML_11 = "1.1";
+
+ /**
+ * Returns the document element
+ * @return
+ */
+ public OMElement getOMDocumentElement();
+
+ /**
+ * Sets the document element of the XML document
+ * @param rootElement
+ */
+ public void setOMDocumentElement(OMElement rootElement);
+
+ /**
+ * Returns the XML version
+ * @return
+ */
+ public String getXMLVersion();
+
+ /**
+ * Sets the XML version
+ * @see org.apache.axis2.om.impl.llom.OMDocumentImpl#XML_10 XML 1.0
+ * @see org.apache.axis2.om.impl.llom.OMDocumentImpl#XML_11 XML 1.1
+ * @param version
+ */
+ public void setXMLVersion(String version);
+
+ /**
+ * Returns the caracter set encoding scheme
+ * @return
+ */
+ public String getCharsetEncoding();
+
+ /**
+ * Sets the character set encoding scheme to be used
+ * @param charsetEncoding
+ */
+ public void setCharsetEncoding(String charsetEncoding);
/**
* XML standalone value
* This will be yes, no or null (if not available)
- * @return
+ * @return boolean
*/
public String isStandalone();
public void setStandalone(String isStandalone);
/**
- * Serialize the OMDocument
- * @param omOutput
- * @throws XMLStreamException
- */
- public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException;
-
- /**
- * Serilize the OMDocument with the option of excluding/including the
- * XML declaration
- * @param omOutput
- * @param includeXMLDeclaration Whether to include the XML declaration or not
- * @throws XMLStreamException
- */
- public void serializeAndConsume(OMOutputImpl omOutput, boolean includeXMLDeclaration) throws XMLStreamException;
-
- /**
- * Serializa the document with cache on
- * @param omOutput
- * @throws XMLStreamException
- */
- public void serialize(OMOutputImpl omOutput) throws XMLStreamException;
-
- /**
- * Seralize the document with cache on with the option on excluding the XML declaration
- * @param omOutput
- * @param includeXMLDeclaration
- * @throws XMLStreamException
- */
- public void serialize(OMOutputImpl omOutput, boolean includeXMLDeclaration) throws XMLStreamException;
+ * Serialize the OMDocument
+ * @param omOutput
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException;
+
+ /**
+ * Serializa the document with cache on
+ * @param omOutput
+ * @throws XMLStreamException
+ */
+ public void serialize(OMOutputImpl omOutput) throws XMLStreamException;
+
+ /**
+ * Serialize the OMDocument
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException;
+
+ /**
+ * Serializa the document with cache on
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serialize(OutputStream output) throws XMLStreamException;
}
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMNode.java Tue Nov 29 21:19:30 2005
@@ -21,6 +21,8 @@
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.Writer;
/**
* Defines the the base interface used by most of the XML object model within Axis.
@@ -194,6 +196,27 @@
throws XMLStreamException;
/**
+ * Serialize the node with caching
+ *
+ * @param output
+ * @throws XMLStreamException
+ * @see #serialize(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serialize(OutputStream output)
+ throws XMLStreamException;
+
+ /**
+ * Serialize the node with caching
+ *
+ * @param writer
+ * @throws XMLStreamException
+ * @see #serialize(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serialize(Writer writer)
+ throws XMLStreamException;
+
+
+ /**
* Serialize the node without caching
*
* @param xmlWriter
@@ -210,6 +233,24 @@
* @see #serializeAndConsume(org.apache.axis2.om.impl.OMOutputImpl)
*/
public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException;
+
+ /**
+ * Serialize the node without caching
+ *
+ * @param output
+ * @throws XMLStreamException
+ * @see #serializeAndConsume(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException;
+
+ /**
+ * Serialize the node without caching
+ *
+ * @param writer
+ * @throws XMLStreamException
+ * @see #serializeAndConsume(org.apache.axis2.om.impl.OMOutputImpl)
+ */
+ public void serializeAndConsume(Writer writer) throws XMLStreamException;
/**
* Builds itself
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/OMOutputImpl.java Tue Nov 29 21:19:30 2005
@@ -218,7 +218,7 @@
return ignoreXMLDeclaration;
}
- public void ignoreXMLDeclaration(boolean ignoreXMLDeclaration) {
+ public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
this.ignoreXMLDeclaration = ignoreXMLDeclaration;
}
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocumentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocumentImpl.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocumentImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMDocumentImpl.java Tue Nov 29 21:19:30 2005
@@ -30,6 +30,8 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import java.util.Iterator;
+import java.io.OutputStream;
+import java.io.IOException;
/**
* Class OMDocumentImpl
@@ -100,7 +102,7 @@
/**
* Method getRootElement
*
- * @return
+ * @return om element
*/
public OMElement getOMDocumentElement() {
while (rootElement == null) {
@@ -123,7 +125,7 @@
* If somethings info are not available in the item, one has to check this attribute to make sure that, this
* item has been parsed completely or not.
*
- * @return
+ * @return boolean
*/
public boolean isComplete() {
return done;
@@ -188,7 +190,7 @@
* This returns a collection of this element.
* Children can be of types OMElement, OMText.
*
- * @return
+ * @return iterator
*/
public Iterator getChildren() {
return new OMChildrenIterator(getFirstOMChild());
@@ -211,7 +213,7 @@
/**
* Method getFirstOMChild
*
- * @return
+ * @return first om child
*/
public OMNode getFirstOMChild() {
while ((firstChild == null) && !done) {
@@ -254,7 +256,7 @@
/**
* Returns the character set encoding scheme to be used
*
- * @return
+ * @return charset
*/
public String getCharsetEncoding() {
return charSetEncoding;
@@ -294,9 +296,6 @@
/**
* Serialize the document with the XML declaration
- *
- * @see org.apache.axis2.om.OMDocument#serializeAndConsume(org.apache.axis2.om.impl.OMOutputImpl,
- * boolean)
*/
public void serializeAndConsume(OMOutputImpl omOutput)
throws XMLStreamException {
@@ -315,9 +314,31 @@
}
/**
+ * Serialize the document directly to the outputstream with Caching disabled
+ *
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException {
+ OMOutputImpl omOutput = new OMOutputImpl(output,false);
+ serializeAndConsume(omOutput);
+ omOutput.flush();
+ }
+
+ /**
+ * Serialize the document directly to the outputstream with Caching enabled
+ *
+ * @param output
+ * @throws XMLStreamException
+ */
+ public void serialize(OutputStream output) throws XMLStreamException {
+ OMOutputImpl omOutput = new OMOutputImpl(output,false);
+ serialize(omOutput);
+ omOutput.flush();
+ }
+
+ /**
* Serialize the document with cache
- *
- * @see org.apache.axis2.om.OMDocument#serialize(org.apache.axis2.om.impl.OMOutputImpl, boolean)
*/
public void serialize(OMOutputImpl omOutput, boolean includeXMLDeclaration) throws XMLStreamException {
serialize(omOutput, true, includeXMLDeclaration);
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java Tue Nov 29 21:19:30 2005
@@ -32,7 +32,10 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLOutputFactory;
import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.Writer;
import java.util.HashMap;
import java.util.Iterator;
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMNodeImpl.java Tue Nov 29 21:19:30 2005
@@ -26,6 +26,9 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLOutputFactory;
+import java.io.OutputStream;
+import java.io.Writer;
/**
* Class OMNodeImpl
@@ -238,7 +241,7 @@
*
* @return Returns the type of node as indicated by {@link #setType}
*
- * @see #setType
+ * @see #setType
*/
public int getType() {
return nodeType;
@@ -334,6 +337,22 @@
*/
public void serializeAndConsume(OMOutputImpl omOutput) throws XMLStreamException {
throw new RuntimeException("Not implemented yet!");
+ }
+
+ public void serialize(OutputStream output) throws XMLStreamException {
+ serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(output));
+ }
+
+ public void serialize(Writer writer) throws XMLStreamException {
+ serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+ }
+
+ public void serializeAndConsume(OutputStream output) throws XMLStreamException {
+ serializeAndConsume(XMLOutputFactory.newInstance().createXMLStreamWriter(output));
+ }
+
+ public void serializeAndConsume(Writer writer) throws XMLStreamException {
+ serializeAndConsume(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
}
}
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/AbstractOMSerializationTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/AbstractOMSerializationTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/AbstractOMSerializationTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/AbstractOMSerializationTest.java Tue Nov 29 21:19:30 2005
@@ -81,7 +81,7 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OMOutputImpl omOutput = new OMOutputImpl(baos, false);
- omOutput.ignoreXMLDeclaration(ignoreXMLDeclaration);
+ omOutput.setIgnoreXMLDeclaration(ignoreXMLDeclaration);
// rootElement.serializeAndConsume(omOutput);
((OMDocument) rootElement.getParent()).serialize(omOutput);
@@ -107,15 +107,11 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputImpl omOutput = new OMOutputImpl(baos, false);
-// omOutput.ignoreXMLDeclaration(ignoreXMLDeclaration);
-
if (ignoreDocument) {
- rootElement.serialize(omOutput);
+ rootElement.serialize(baos);
} else {
- ((OMDocument) rootElement.getParent()).serialize(omOutput);
+ ((OMDocument) rootElement.getParent()).serialize(baos);
}
- omOutput.flush();
InputSource resultXML = new InputSource(new InputStreamReader(
new ByteArrayInputStream(baos.toByteArray())));
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMBlankElementTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMBlankElementTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMBlankElementTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMBlankElementTest.java Tue Nov 29 21:19:30 2005
@@ -51,8 +51,7 @@
StringWriter writer = new StringWriter();
elem1.build();
- elem1.serialize(new OMOutputImpl(XMLOutputFactory
- .newInstance().createXMLStreamWriter(writer)));
+ elem1.serialize(writer);
writer.flush();
return writer.toString();
}
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/OMDocumentTest.java Tue Nov 29 21:19:30 2005
@@ -42,9 +42,7 @@
// serialise it to a string
String outXML = "";
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- OMOutputImpl output = new OMOutputImpl(outStream, false);
- omDocument.serializeAndConsume(output);
- output.flush();
+ omDocument.serializeAndConsume(outStream);
outXML = new String(outStream.toByteArray());
// again load that to another builder
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/OMBlankElementTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/OMBlankElementTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/OMBlankElementTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/OMBlankElementTest.java Tue Nov 29 21:19:30 2005
@@ -35,8 +35,7 @@
StringWriter writer = new StringWriter();
elem1.build();
- elem1.serialize(
- new OMOutputImpl(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)));
+ elem1.serialize(writer);
writer.flush();
return writer.toString();
}
@@ -59,8 +58,7 @@
StringWriter writer = new StringWriter();
elem1.build();
- elem1.serialize(
- new OMOutputImpl(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)));
+ elem1.serialize(writer);
writer.flush();
return writer.toString();
}
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMDocumentSerilizationTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMDocumentSerilizationTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMDocumentSerilizationTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/OMDocumentSerilizationTest.java Tue Nov 29 21:19:30 2005
@@ -65,9 +65,7 @@
public void testXMLDecleration() throws XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputImpl output = new OMOutputImpl(baos,false);
- document.serializeAndConsume(output);
- output.flush();
+ document.serializeAndConsume(baos);
String xmlDocument = new String(baos.toByteArray());
@@ -77,7 +75,8 @@
public void testExcludeXMLDeclaration() throws XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OMOutputImpl output = new OMOutputImpl(baos,false);
- document.serializeAndConsume(output,false);
+ output.setIgnoreXMLDeclaration(true);
+ document.serializeAndConsume(output);
output.flush();
String xmlDocument = new String(baos.toByteArray());
@@ -89,10 +88,7 @@
public void testCharsetEncoding() throws XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputImpl output = new OMOutputImpl(baos,false);
- output.ignoreXMLDeclaration(false);
- document.serializeAndConsume(output);
- output.flush();
+ document.serializeAndConsume(baos);
String xmlDocument = new String(baos.toByteArray());
@@ -117,9 +113,7 @@
public void testXMLVersion() throws XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputImpl output = new OMOutputImpl(baos,false);
- document.serializeAndConsume(output);
- output.flush();
+ document.serializeAndConsume(baos);
String xmlDocument = new String(baos.toByteArray());
assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version) ||
@@ -128,10 +122,8 @@
public void testXMLVersion_11() throws XMLStreamException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputImpl output = new OMOutputImpl(baos,false);
document.setXMLVersion("1.1");
- document.serializeAndConsume(output);
- output.flush();
+ document.serializeAndConsume(baos);
String xmlDocument = new String(baos.toByteArray());
assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version_11) ||
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/serializer/NoNamespaceSerializerTest.java Tue Nov 29 21:19:30 2005
@@ -133,14 +133,7 @@
new ByteArrayInputStream(xmlText2.getBytes()))));
env.getBody().addChild(builder.getDocumentElement());
- org.apache.axis2.om.impl.OMOutputImpl omOutput = new org.apache.axis2.om.impl.OMOutputImpl(System.out, false);
- //env.getBody().addChild(builder.getDocumentElement());
-
- env.serialize(omOutput);
- // env.serializeAndConsume(xmlStreamWriter, true);
-
- omOutput.flush();
-
+ env.serialize(System.out);
}
public void testSerilizationWithCacheOn() throws Exception {
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/streamwrapper/OmStAXBuilderTest.java Tue Nov 29 21:19:30 2005
@@ -53,10 +53,7 @@
public void testStaxBuilder() throws Exception {
SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
assertNotNull(envelope);
- org.apache.axis2.om.impl.OMOutputImpl omOutput = new org.apache.axis2.om.impl.OMOutputImpl(new FileOutputStream(tempFile),
- false);
- // XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- envelope.serialize(omOutput);
+ envelope.serialize(new FileOutputStream(tempFile));
}
Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceUnit.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceUnit.java?rev=349881&r1=349880&r2=349881&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceUnit.java (original)
+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/infoset/XMLConformanceUnit.java Tue Nov 29 21:19:30 2005
@@ -67,15 +67,8 @@
new FileInputStream(filePath)));
rootElement = staxOMBuilder.getDocumentElement();
- XMLStreamWriter writer;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(baos);
-
- ((OMDocument)rootElement.getParent()).serialize(new OMOutputImpl(writer));
-
- writer.flush();
- writer.close();
+ ((OMDocument)rootElement.getParent()).serialize(baos);
InputSource resultXML = new InputSource(new InputStreamReader(
new ByteArrayInputStream(baos.toByteArray())));