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 ve...@apache.org on 2005/06/03 16:23:50 UTC
svn commit: r179795 [1/4] - in
/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject:
./ bin/ src/org/apache/axis/encoding/ src/org/apache/axis/om/
src/org/apache/axis/om/impl/llom/ src/org/apache/axis/om/impl/llom/builder/
src/org/apache/axis/om/impl/llom/factory/
src/org/apache/axis/om/impl/llom/mtom/
src/org/apache/axis/om/impl/llom/serialize/
src/org/apache/axis/om/impl/llom/traverse/
src/org/apache/axis/om/impl/llom/util/ src/org/apache/axis/om/impl/mtom/
src/org/apache/axis/soap/ src/org/apache/axis/soap/impl/
src/org/apache/axis/soap/impl/llom/
src/org/apache/axis/soap/impl/llom/builder/
src/org/apache/axis/soap/impl/llom/factory/
src/org/apache/axis/soap/impl/llom/soap11/
src/org/apache/axis/soap/impl/llom/soap12/ test/org/ test/org/apache/
test/org/apache/axis/ test/org/apache/axis/om/
test/org/apache/axis/om/infoset/
Author: venkat
Date: Fri Jun 3 07:23:47 2005
New Revision: 179795
URL: http://svn.apache.org/viewcvs?rev=179795&view=rev
Log:
Updated files for infoset support xml conformance testing by Jaya.
Added:
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/encoding/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataHandler.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataSource.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMAbstractFactory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMSerializerUtil.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/mtom/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/util/EmptyIterator.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/mtom/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPBody.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPEnvelope.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFactory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFault.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultCode.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultCodeValue.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultDetail.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultNode.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultReason.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultRole.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultSubCode.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPFaultSubCodeValue.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPHeader.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPHeaderBlock.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/SOAPText.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPBodyImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPConstants.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPEnvelopeImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPFaulReasonImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPFaultImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPHeaderBlockImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPHeaderImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/SOAPTextImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/builder/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/builder/StAXSOAPModelBuilder.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/factory/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/factory/SOAPLinkedListImplFactory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/soap11/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/soap11/SOAP11Constants.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/soap11/SOAP11Factory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/soap12/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/soap12/SOAP12Constants.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/soap/impl/llom/soap12/SOAP12Factory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/org/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/org/apache/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/org/apache/axis/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/org/apache/axis/om/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/org/apache/axis/om/infoset/
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/org/apache/axis/om/infoset/XMLConformanceTest.java
Removed:
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/.classpath
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/.project
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/bin/
Modified:
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/FactoryFinder.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMConstants.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMElement.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMFactory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMNode.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMSerializer.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMText.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMCommentImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDTDImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDocument.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMElementImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMNavigator.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMPIImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMTextImpl.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/SAXOMBuilder.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXBuilder.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMLinkedListImplFactory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMXMLBuilderFactory.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenWithSpecificAttributeIterator.java
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/util/XMLComparator.java
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataHandler.java?rev=179795&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataHandler.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataHandler.java Fri Jun 3 07:23:47 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.om;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+
+
+/**
+ * @author srinath
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public interface DataHandler {
+ public void init(String value, String mimeType);
+ /**
+ * @return
+ * @throws java.io.IOException
+ */
+ public abstract Object getContent() throws IOException;
+ /**
+ * @return
+ */
+ public abstract String getContentType();
+ /**
+ * @return
+ */
+ public abstract DataSource getDataSource();
+ /**
+ * @return
+ * @throws java.io.IOException
+ */
+ public abstract InputStream getInputStream() throws IOException;
+ /**
+ * @return
+ */
+ public abstract String getName();
+ /**
+ * @return
+ * @throws java.io.IOException
+ */
+ public abstract OutputStream getOutputStream() throws IOException;
+
+ public abstract void writeTo(OutputStream arg0) throws IOException;
+}
\ No newline at end of file
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataSource.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataSource.java?rev=179795&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataSource.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/DataSource.java Fri Jun 3 07:23:47 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.om;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author srinath
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public interface DataSource {
+ /**
+ * @return
+ */
+ public abstract String getContentType();
+ /**
+ * @return
+ * @throws java.io.IOException
+ */
+ public abstract InputStream getInputStream() throws IOException;
+ /**
+ * @return
+ */
+ public abstract String getName();
+ /**
+ * @return
+ * @throws java.io.IOException
+ */
+ public abstract OutputStream getOutputStream() throws IOException;
+}
\ No newline at end of file
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/FactoryFinder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/FactoryFinder.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/FactoryFinder.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/FactoryFinder.java Fri Jun 3 07:23:47 2005
@@ -15,37 +15,102 @@
*/
package org.apache.axis.om;
+import org.apache.axis.soap.SOAPFactory;
+
+
/**
* Class FactoryFinder
*/
class FactoryFinder {
- /**
- * Field DEFAULT_CLASS_NAME
- */
- private static final String DEFAULT_CLASS_NAME =
+ private static final String DEFAULT_OM_FACTORY_CLASS_NAME =
"org.apache.axis.om.impl.llom.factory.OMLinkedListImplFactory";
+ private static final String DEFAULT_SOAP11_FACTORY_CLASS_NAME =
+ "org.apache.axis.soap.impl.llom.soap11.SOAP11Factory";
+ private static final String DEFAULT_SOAP12_FACTORY_CLASS_NAME =
+ "org.apache.axis.om.impl.llom.soap11.SOAP12Factory";
+
+ private static final String OM_FACTORY_NAME_PROPERTY = "om.factory";
+ private static final String SOAP11_FACTORY_NAME_PROPERTY = "soap11.factory";
+ private static final String SOAP12_FACTORY_NAME_PROPERTY = "soap12.factory";
+
/**
- * This needs to be improved. Currently the factory is loaded only from the default implementation
- * However provisions should be made to load a custom factory depending on the users setting
- * Say an environment variable
*
* @param loader
* @return
* @throws OMFactoryException
*/
- public static OMFactory findFactory(ClassLoader loader)
+
+
+ private static Object findFactory(ClassLoader loader, String factoryClass, String systemPropertyName)
throws OMFactoryException {
+
+ String factoryClassName = factoryClass;
+
+ //first look for a java system property
+ if (System.getProperty(systemPropertyName) != null) {
+ factoryClassName = systemPropertyName;
+ }
+ ;
+
Object factory = null;
try {
if (loader == null) {
- factory = Class.forName(DEFAULT_CLASS_NAME).newInstance();
+ factory = Class.forName(factoryClassName).newInstance();
} else {
- factory = loader.loadClass(DEFAULT_CLASS_NAME).newInstance();
+ factory = loader.loadClass(factoryClassName).newInstance();
}
} catch (Exception e) {
throw new OMFactoryException(e);
}
- return (OMFactory) factory;
+ return factory;
+ }
+
+ /**
+ * The searching for the factory class happens in the following order
+ * 1. look for a system property called <b>soap11.factory</b>. this can be set by
+ * passing the -Dsoap11.factory="classname"
+ * 2. Pick the default factory class.
+ * it is the class hardcoded at the constant DEFAULT_SOAP11_FACTORY_CLASS_NAME
+ *
+ * @param loader
+ * @return
+ * @throws OMFactoryException
+ */
+ public static SOAPFactory findSOAP11Factory(ClassLoader loader)
+ throws OMFactoryException {
+ return (SOAPFactory) findFactory(loader, DEFAULT_SOAP11_FACTORY_CLASS_NAME, SOAP11_FACTORY_NAME_PROPERTY);
+ }
+
+ /**
+ * The searching for the factory class happens in the following order
+ * 1. look for a system property called <b>soap12.factory</b>. this can be set by
+ * passing the -Dsoap12.factory="classname"
+ * 2. Pick the default factory class.
+ * it is the class hardcoded at the constant DEFAULT_SOAP12_FACTORY_CLASS_NAME
+ *
+ * @param loader
+ * @return
+ * @throws OMFactoryException
+ */
+ public static SOAPFactory findSOAP12Factory(ClassLoader loader)
+ throws OMFactoryException {
+ return (SOAPFactory) findFactory(loader, DEFAULT_SOAP12_FACTORY_CLASS_NAME, SOAP12_FACTORY_NAME_PROPERTY);
+ }
+
+ /**
+ * The searching for the factory class happens in the following order
+ * 1. look for a system property called <b>om.factory</b>. this can be set by
+ * passing the -Dom.factory="classname"
+ * 2. Pick the default factory class.
+ * it is the class hardcoded at the constant DEFAULT_OM_FACTORY_CLASS_NAME
+ *
+ * @param loader
+ * @return
+ * @throws OMFactoryException
+ */
+ public static OMFactory findOMFactory(ClassLoader loader)
+ throws OMFactoryException {
+ return (OMFactory) findFactory(loader, DEFAULT_OM_FACTORY_CLASS_NAME, OM_FACTORY_NAME_PROPERTY);
}
}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMAbstractFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMAbstractFactory.java?rev=179795&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMAbstractFactory.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMAbstractFactory.java Fri Jun 3 07:23:47 2005
@@ -0,0 +1,92 @@
+package org.apache.axis.om;
+
+import org.apache.axis.soap.SOAPFactory;
+import org.apache.axis.soap.impl.llom.factory.SOAPLinkedListImplFactory;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ * <p/>
+ */
+public class OMAbstractFactory {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+ /**
+ * Constructor OMFactory
+ */
+ protected OMAbstractFactory() {
+ }
+
+ /**
+ * This will pick up the default factory implementation from the classpath
+ *
+ * @return
+ */
+ public static OMFactory getOMFactory() {
+ return FactoryFinder.findOMFactory(null);
+ }
+
+ /**
+ * If user needs to provide his own factory implementation, here provide the
+ * Class Loader for that.
+ * @param classLoader
+ * @return
+ */
+ public static OMFactory getOMFactory(ClassLoader classLoader) {
+ return FactoryFinder.findOMFactory(classLoader);
+ }
+
+ /**
+ * This will pick up the default factory implementation from the classpath
+ *
+ * @return
+ */
+ public static SOAPFactory getSOAP11Factory() {
+ return FactoryFinder.findSOAP11Factory(null);
+ }
+
+ /**
+ * If user needs to provide his own factory implementation, here provide the
+ * Class Loader for that.
+ * @param classLoader
+ * @return
+ */
+ public static SOAPFactory getSOAP11Factory(ClassLoader classLoader) {
+ return FactoryFinder.findSOAP11Factory(classLoader);
+ }
+
+ /**
+ * This will pick up the default factory implementation from the classpath
+ *
+ * @return
+ */
+ public static SOAPFactory getSOAP12Factory() {
+ return FactoryFinder.findSOAP12Factory(null);
+ }
+
+ /**
+ * If user needs to provide his own factory implementation, here provide the
+ * Class Loader for that.
+ * @param classLoader
+ * @return
+ */
+ public static SOAPFactory getSOAP12Factory(ClassLoader classLoader) {
+ return FactoryFinder.findSOAP12Factory(classLoader);
+ }
+
+ public static SOAPFactory getDefaultSOAPFactory() {
+ return new SOAPLinkedListImplFactory();
+ }
+}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMConstants.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMConstants.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMConstants.java Fri Jun 3 07:23:47 2005
@@ -19,110 +19,8 @@
* Interface OMConstants
*/
public interface OMConstants {
- /**
- * Field SOAP_ENVELOPE_NAMESPACE_URI
- */
- public static final String SOAP_ENVELOPE_NAMESPACE_URI =
- "http://schemas.xmlsoap.org/soap/envelope/";
-
- /**
- * Field SOAPENVELOPE_NAMESPACE_PREFIX
- */
- public static final String SOAPENVELOPE_NAMESPACE_PREFIX = "soapenv";
-
- /**
- * Field SOAPENVELOPE_LOCAL_NAME
- */
- public static final String SOAPENVELOPE_LOCAL_NAME = "Envelope";
-
- // Header constants
- /**
- * Field HEADER_NAMESPACEURI
- */
- public static final String HEADER_NAMESPACEURI =
- SOAP_ENVELOPE_NAMESPACE_URI;
-
- /**
- * Field HEADER_LOCAL_NAME
- */
- public static final String HEADER_LOCAL_NAME = "Header";
-
- /**
- * Field HEADER_NAMESPACE_PREFIX
- */
- public static final String HEADER_NAMESPACE_PREFIX =
- SOAPENVELOPE_NAMESPACE_PREFIX;
-
- // Body Constants
- /**
- * Field BODY_NAMESPACE_URI
- */
- public static final String BODY_NAMESPACE_URI = SOAP_ENVELOPE_NAMESPACE_URI;
-
- /**
- * Field BODY_LOCAL_NAME
- */
- public static final String BODY_LOCAL_NAME = "Body";
-
- /**
- * Field BODY_NAMESPACE_PREFIX
- */
- public static final String BODY_NAMESPACE_PREFIX =
- SOAPENVELOPE_NAMESPACE_PREFIX;
-
- /**
- * Field BODY_FAULT_LOCAL_NAME
- */
- public static final String BODY_FAULT_LOCAL_NAME = "Fault";
-
- // Attribute names of a SOAP Envelope
- /**
- * Field ATTR_ACTOR
- */
- public static final String ATTR_ACTOR = "actor";
-
- /**
- * Field ATTR_MUSTUNDERSTAND
- */
- public static final String ATTR_MUSTUNDERSTAND = "mustUnderstand";
-
- /**
- * Field SOAPFAULT_LOCAL_NAME
- */
- public static final String SOAPFAULT_LOCAL_NAME = "Fault";
-
- /**
- * Field SOAPFAULT_CODE_LOCAL_NAME
- */
- public static final String SOAPFAULT_CODE_LOCAL_NAME = "faultcode";
-
- /**
- * Field SOAPFAULT_STRING_LOCAL_NAME
- */
- public static final String SOAPFAULT_STRING_LOCAL_NAME = "faultstring";
-
- /**
- * Field SOAPFAULT_ACTOR_LOCAL_NAME
- */
- public static final String SOAPFAULT_ACTOR_LOCAL_NAME = "faultactor";
-
- /**
- * Field SOAPFAULT_DETAIL_LOCAL_NAME
- */
- public static final String SOAPFAULT_DETAIL_LOCAL_NAME = "detail";
-
- /**
- * Field SOAPFAULT_NAMESPACE_URI
- */
- public static final String SOAPFAULT_NAMESPACE_URI =
- SOAP_ENVELOPE_NAMESPACE_URI;
-
- /**
- * Field SOAPFAULT_NAMESPACE_PREFIX
- */
- public static final String SOAPFAULT_NAMESPACE_PREFIX =
- SOAPENVELOPE_NAMESPACE_PREFIX;
+
// OMBuilder constants
/**
* Field PUSH_TYPE_BUILDER
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMElement.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMElement.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMElement.java Fri Jun 3 07:23:47 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om;
import javax.xml.namespace.QName;
@@ -52,7 +52,7 @@
* @return
* @throws OMException
*/
- public OMNode getChildWithName(QName elementQName) throws OMException;
+ public OMElement getFirstChildWithName(QName elementQName) throws OMException;
/**
* This returns a collection of this element.
@@ -87,27 +87,16 @@
* @return
* @throws OMException
*/
- public OMNamespace findInScopeNamespace(String uri, String prefix)
+ public OMNamespace findNamespace(String uri, String prefix)
throws OMException;
/**
- * This will ckeck for the namespace <B>only</B> in the current Element
*
- * @param uri
- * @param prefix
* @return
* @throws OMException
*/
- public OMNamespace findDeclaredNamespace(String uri, String prefix)
- throws OMException;
+ public Iterator getAllDeclaredNamespaces() throws OMException;
- /**
- * This will provide a list of namespace defined within this Element <B>only</B>
- *
- * @return
- * @throws OMException
- */
- public Iterator getAllDeclaredNamespaces();
/**
* This will help to search for an attribute with a given QName within this Element
@@ -116,7 +105,7 @@
* @return
* @throws OMException
*/
- public OMAttribute getAttributeWithQName(QName qname) throws OMException;
+ public OMAttribute getFirstAttribute(QName qname) throws OMException;
/**
* This will return a List of OMAttributes
@@ -126,13 +115,20 @@
public Iterator getAttributes();
/**
+ *
+ * @param qname
+ * @return
+ */
+ public Iterator getAttributes(QName qname);
+
+ /**
* This will insert attribute to this element. Implementor can decide as to insert this
* in the front or at the end of set of attributes
*
* @param attr
* @return
*/
- public OMAttribute insertAttribute(OMAttribute attr);
+ public OMAttribute addAttribute(OMAttribute attr);
/**
* @param attributeName
@@ -141,7 +137,7 @@
* must be declared in the parent element of this attribute or ancestors of the parent element of the attribute
* @return
*/
- public OMAttribute insertAttribute(String attributeName, String value,
+ public OMAttribute addAttribute(String attributeName, String value,
OMNamespace ns);
/**
@@ -178,30 +174,39 @@
* @return
*/
public OMNode getFirstChild();
-
+
/**
* Convenience extension of the getFirstChild
* @return
*/
-
+
public OMElement getFirstElement();
+
+
/**
- * Convenience extension of the getNextSibling
- * @return
- */
- public OMElement getNextSiblingElement() throws OMException;
+ * Returns the pull parser that will generate the pull
+ * events relevant to THIS element. Caching is on
+ *
+ * @return
+ */
+ public XMLStreamReader getXMLStreamReader();
/**
* Returns the pull parser that will generate the pull
- * events relevant to THIS element
+ * events relevant to THIS element.caching is off
+ *
*
- * @param cacheOff
* @return
*/
- public XMLStreamReader getPullParser(boolean cacheOff);
+ public XMLStreamReader getXMLStreamReaderWithoutCaching();
/**
+ *
+ * @param text
+ */
+ public void setText(String text);
+ /**
* This will return the non-empty text children as a String
* @return
*/
@@ -222,33 +227,22 @@
public void setLocalName(String localName);
/**
- * Method getNamespace
- *
- * @return
+ * @return the OMNamespace object associated with this element
* @throws OMException
*/
public OMNamespace getNamespace() throws OMException;
/**
- * Method getNamespaceName
- *
- * @return
- */
- public String getNamespaceName();
-
- /**
- * Method setNamespace
- *
+ * sets the Namespace
* @param namespace
*/
public void setNamespace(OMNamespace namespace);
+ /**
+ * Get the Qname of this node
+ * @return
+ */
public QName getQName();
- /**
- * This will completely parse this node and build the object structure in the memory
- * @throws OMException
- */
- public void populateYourSelf() throws OMException ;
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMFactory.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMFactory.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMFactory.java Fri Jun 3 07:23:47 2005
@@ -17,20 +17,21 @@
import javax.xml.namespace.QName;
import org.apache.axis.om.impl.llom.OMDocument;
-//Actually importing a implemenation class in an api abstract class definition is not good
+//Actually importing an implemenation class in an api abstract class definition is not good
//But as of now OMDocument has no corresponding API interface defined for it, hence
//couldn't help importing the above line.
+
/**
* Class OMFactory
*/
-public abstract class OMFactory {
+public interface OMFactory {
/**
* @param localName
* @param ns
* @return
*/
- public abstract OMElement createOMElement(String localName, OMNamespace ns);
+ public OMElement createOMElement(String localName, OMNamespace ns);
/**
* @param localName
@@ -39,7 +40,7 @@
* @param builder
* @return
*/
- public abstract OMElement createOMElement(String localName, OMNamespace ns,
+ public OMElement createOMElement(String localName, OMNamespace ns,
OMElement parent,
OMXMLParserWrapper builder);
@@ -54,7 +55,7 @@
* @param namespacePrefix
* @return
*/
- public abstract OMElement createOMElement(String localName,
+ public OMElement createOMElement(String localName,
String namespaceURI,
String namespacePrefix);
@@ -68,150 +69,58 @@
* @return
* @throws OMException
*/
- public abstract OMElement createOMElement(QName qname, OMElement parent)
+ public OMElement createOMElement(QName qname, OMElement parent)
throws OMException;
/**
- * Method createOMDTD
- *
- * @param parent
- * @param content
- * @return
- */
- public abstract OMDTD createOMDTD(OMDocument parent, String content);
-
- /**
* @param uri
* @param prefix
* @return
*/
- public abstract OMNamespace createOMNamespace(String uri, String prefix);
+ public OMNamespace createOMNamespace(String uri, String prefix);
/**
* @param parent
* @param text
* @return
*/
- public abstract OMText createText(OMElement parent, String text);
+ public OMText createText(OMElement parent, String text);
/**
- * @param parent
- * @param piTarget
- * @param piData
- * @return
- */
- public abstract OMPI createOMPI(OMElement parent, String piTarget, String piData);
-
- /**
- * @param parent
- * @param content
- * @return
- */
- public abstract OMComment createOMComment(OMElement parent, String content);
-
- /**
* @param s
* @return
*/
- public abstract OMText createText(String s);
-
- /**
- * @param envelope
- * @return
- */
- public abstract SOAPBody createSOAPBody(SOAPEnvelope envelope);
-
- /**
- * @param envelope
- * @param builder
- * @return
- */
- public abstract SOAPBody createSOAPBody(SOAPEnvelope envelope,
- OMXMLParserWrapper builder);
-
- /**
- * @param ns
- * @param builder
- * @return
- */
- public abstract SOAPEnvelope createSOAPEnvelope(OMNamespace ns,
- OMXMLParserWrapper builder);
-
- /**
- * @param ns
- * @return
- */
- public abstract SOAPEnvelope createSOAPEnvelope(OMNamespace ns);
-
- /**
- * @param envelope
- * @return
- */
- public abstract SOAPHeader createSOAPHeader(SOAPEnvelope envelope);
-
- /**
- * @param envelope
- * @param builder
- * @return
- */
- public abstract SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
- OMXMLParserWrapper builder);
-
- /**
- * @param localName
- * @param ns
- * @return
- */
- public abstract SOAPHeaderBlock createSOAPHeaderBlock(String localName,
- OMNamespace ns);
+ public OMText createText(String s);
+ public OMAttribute createOMAttribute(String localName, OMNamespace ns, String value);
+
/**
- * @param localName
- * @param ns
+ * Method createOMDTD
+ *
* @param parent
- * @param builder
+ * @param content
* @return
*/
- public abstract SOAPHeaderBlock createSOAPHeaderBlock(String localName,
- OMNamespace ns, OMElement parent, OMXMLParserWrapper builder);
+ public abstract OMDTD createOMDTD(OMDocument parent, String content);
/**
* @param parent
- * @param e
+ * @param piTarget
+ * @param piData
* @return
*/
- public abstract SOAPFault createSOAPFault(SOAPBody parent, Exception e);
-
+ public abstract OMPI createOMPI(OMElement parent, String piTarget, String piData);
+
/**
- * @param ns
* @param parent
- * @param builder
+ * @param content
* @return
*/
- public abstract SOAPFault createSOAPFault(OMNamespace ns, SOAPBody parent,
- OMXMLParserWrapper builder);
+ public abstract OMComment createOMComment(OMElement parent, String content);
+
// make the constructor protected
- /**
- * Constructor OMFactory
- */
- protected OMFactory() {
- }
-
- /**
- * Method newInstance
- *
- * @return
- */
- public static OMFactory newInstance() {
- return FactoryFinder.findFactory(null);
- }
- /**
- * Method getDefaultEnvelope
- *
- * @return
- */
- public abstract SOAPEnvelope getDefaultEnvelope();
+
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMNode.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMNode.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMNode.java Fri Jun 3 07:23:47 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om;
import javax.xml.stream.XMLStreamException;
@@ -28,11 +28,6 @@
public static final short ELEMENT_NODE = 1;
/**
- * The node is an <code>Attr</code>.
- */
- public static final short ATTRIBUTE_NODE = 2;
-
- /**
* The node is a <code>Text</code> node.
*/
public static final short TEXT_NODE = 3;
@@ -47,10 +42,7 @@
*/
public static final short COMMENT_NODE = 8;
- /**
- * The node is a <code>Document</code>.
- */
- public static final short DOCUMENT_NODE = 9;
+ public static final short BLOB_NODE = 8;
/**
* This method should return the immediate parent of the node.
@@ -84,24 +76,6 @@
public void setNextSibling(OMNode node);
/**
- * This will return the literal value of the node.
- * OMText --> the text
- * OMElement --> local name of the element in String format
- * OMAttribute --> the value of the attribue
- *
- * @return
- * @throws OMException
- */
- public String getValue() throws OMException;
-
- /**
- * Method setValue
- *
- * @param value
- */
- public void setValue(String value);
-
- /**
* 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
* item has been parsed completely or not.
@@ -118,15 +92,22 @@
public void setComplete(boolean state);
/**
- * This will remove this information item and its children, from the model completely
- *
+ * 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 void detach() throws OMException;
+ public OMNode detach() throws OMException;
+
+ /**
+ * 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
*/
@@ -142,43 +123,50 @@
/**
* This is to get the type of node, as this is the super class of all the nodes
- *
* @return
* @throws OMException
*/
- public short getType() throws OMException;
+ public int getType() throws OMException;
/**
* Method setType
- *
* @param nodeType
* @throws OMException
*/
- public void setType(short nodeType) throws OMException;
+ public void setType(int nodeType) throws OMException;
/**
* 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
+ */
+ public void serializeWithCache(XMLStreamWriter writer)
+ throws XMLStreamException;
+
+ /**
+ * Serilaize the node without caching
+ * @see #serialize(javax.xml.stream.XMLStreamWriter)
* @param writer
- * @param cache
* @throws XMLStreamException
*/
- public void serialize(XMLStreamWriter writer, boolean cache)
- throws XMLStreamException;
+ public void serialize(XMLStreamWriter writer) throws XMLStreamException;
- public void serialize(XMLStreamWriter writer)
- throws XMLStreamException;
+ /**
+ * Builds itself
+ */
+ public void build();
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMSerializer.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMSerializer.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMSerializer.java Fri Jun 3 07:23:47 2005
@@ -23,7 +23,7 @@
*/
public interface OMSerializer {
/**
- * Method serialize
+ * Method serializeWithCache
*
* @param obj
* @param writer
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMText.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMText.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMText.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/OMText.java Fri Jun 3 07:23:47 2005
@@ -20,17 +20,20 @@
*/
public interface OMText extends OMNode {
/**
- * We use the OMText class to hold comments, text, characterData, CData, etc.,
- * The codes are found in OMNode class
- *
- * @param type
+ * Returns the text value of this node
+ * @return
*/
- public void setTextType(short type);
+ String getText();
+
+ /*
+ * Re think about this
+ */
+ DataHandler getDataHandler();
/**
- * Method getTextType
*
- * @return
+ * @return boolean flag saying whether the node contains
+ * an optimized text or not
*/
- public short getTextType();
+ boolean isOptimized();
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMCommentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMCommentImpl.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMCommentImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMCommentImpl.java Fri Jun 3 07:23:47 2005
@@ -21,6 +21,8 @@
* Window - Preferences - Java - Code Style - Code Templates
*/
public class OMCommentImpl extends OMNodeImpl implements OMComment {
+
+ protected String value;
//Object parent;
@@ -34,7 +36,7 @@
} else {
throw new OMException("Comment should have a non-null Document or Element as its parent");
}
- setValue(contentText);
+ this.value = contentText;
}
/**
@@ -59,18 +61,33 @@
}
public String getContent() {
- return getValue();
+ return value;
}
public void serialize (XMLStreamWriter writer) throws XMLStreamException {
serialize(writer, false);
}
- public void serialize (XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+ public void serializeWithCache (XMLStreamWriter writer) throws XMLStreamException {
+ serialize(writer, true);
+ }
+
+ private void serialize (XMLStreamWriter writer, boolean cache) throws XMLStreamException {
writer.writeComment(this.value);
OMNode nextSibling = this.getNextSibling();
if (nextSibling != null) {
- nextSibling.serialize(writer, cache);
+ if(!cache)
+ nextSibling.serialize(writer);
+ else
+ nextSibling.serializeWithCache(writer);
}
}
+
+ public void discard() throws OMException {
+ if (done) {
+ this.detach();
+ } else {
+ builder.discard(this.parent);
+ }
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDTDImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDTDImpl.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDTDImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDTDImpl.java Fri Jun 3 07:23:47 2005
@@ -11,6 +11,7 @@
import org.apache.axis.om.OMDTD;
import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNode;
/**
@@ -21,20 +22,25 @@
*/
public class OMDTDImpl extends OMNodeImpl implements OMDTD {
+ String value;
+
public OMDTDImpl(OMElement parentNode, String content) {
super(parentNode);
- this.setValue(content);
+ this.value = content;
}
/* (non-Javadoc)
* @see org.apache.axis.om.OMNode#serialize(javax.xml.stream.XMLStreamWriter, boolean)
*/
- public void serialize(XMLStreamWriter writer, boolean cache)
+ private void serialize(XMLStreamWriter writer, boolean cache)
throws XMLStreamException {
writer.writeDTD(this.value);
OMNode nextSibling = this.getNextSibling();
if (nextSibling != null) {
- nextSibling.serialize(writer, cache);
+ if(!cache)
+ nextSibling.serialize(writer);
+ else
+ nextSibling.serializeWithCache(writer);
}
}
@@ -44,5 +50,17 @@
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
serialize(writer,false);
}
+
+ public void serializeWithCache(XMLStreamWriter writer) throws XMLStreamException {
+ serialize(writer,true);
+ }
+
+ public void discard() throws OMException {
+ if (done) {
+ this.detach();
+ } else {
+ builder.discard(this.parent);
+ }
+ }
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDocument.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDocument.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDocument.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMDocument.java Fri Jun 3 07:23:47 2005
@@ -16,8 +16,14 @@
package org.apache.axis.om.impl.llom;
import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNode;
import org.apache.axis.om.OMXMLParserWrapper;
+import java.util.Iterator;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+
+
/**
* Class OMDocument
*/
@@ -58,7 +64,7 @@
* @return
*/
public OMElement getRootElement() {
- while (rootElement == null) {
+ if (rootElement == null) {
parserWrapper.next();
}
return rootElement;
@@ -71,5 +77,30 @@
*/
public void setRootElement(OMElement rootElement) {
this.rootElement = rootElement;
+ }
+
+ //Though for historic reasons OMDocument has been made to extend OMElement
+ //during serialization of OMDocument we wouldn't expect it to get serialized
+ //like any OMElement. Hence am overriding this method.
+ //Essentially, serializing a OMDocument means writing out all its children
+ //and only the children i.e. OMDocument start and end parts are abstract and
+ //should not figure in the written out piece of XML
+ private void serialize(XMLStreamWriter writer, boolean cache)
+ throws XMLStreamException {
+ OMNode firstChild;
+ firstChild = this.getFirstChild();
+
+ if(!cache)
+ firstChild.serialize(writer);
+ else
+ firstChild.serializeWithCache(writer);
+ }
+
+ public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+ serialize(writer, false);
+ }
+
+ public void serializeWithCache(XMLStreamWriter writer) throws XMLStreamException {
+ serialize(writer, true);
}
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMElementImpl.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMElementImpl.java Fri Jun 3 07:23:47 2005
@@ -1,25 +1,25 @@
/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.om.impl.llom;
import org.apache.axis.om.*;
import org.apache.axis.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
-import org.apache.axis.om.impl.llom.serialize.StreamingOMSerializer;
import org.apache.axis.om.impl.llom.traverse.OMChildrenIterator;
import org.apache.axis.om.impl.llom.traverse.OMChildrenQNameIterator;
+import org.apache.axis.om.impl.llom.util.EmptyIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,20 +47,17 @@
*/
protected OMNode firstChild;
- /**
- * Field builder
- */
- protected OMXMLParserWrapper builder;
+
/**
* Field namespaces
*/
- private HashMap namespaces = null;
+ protected HashMap namespaces = null;
/**
* Field attributes
*/
- private HashMap attributes = null;
+ protected HashMap attributes = null;
/**
* Field log
@@ -70,7 +67,7 @@
/**
* Field noPrefixNamespaceCounter
*/
- private int noPrefixNamespaceCounter = 0;
+ protected int noPrefixNamespaceCounter = 0;
/**
* Constructor OMElementImpl
@@ -145,7 +142,7 @@
// first try to find a namespace from the scope
String namespaceURI = qname.getNamespaceURI();
if (!"".equals(namespaceURI)) {
- ns = findInScopeNamespace(qname.getNamespaceURI(),
+ ns = findNamespace(qname.getNamespaceURI(),
qname.getPrefix());
} else {
if (parent != null) {
@@ -183,7 +180,7 @@
* @return
*/
private OMNamespace handleNamespace(OMNamespace ns) {
- OMNamespace namespace = findInScopeNamespace(ns.getName(),
+ OMNamespace namespace = findNamespace(ns.getName(),
ns.getPrefix());
if (namespace == null) {
namespace = declareNamespace(ns);
@@ -217,21 +214,23 @@
}
/**
- * Method getChildWithName
+ * Method getFirstChildWithName
*
* @param elementQName
* @return
* @throws OMException
*/
- public OMNode getChildWithName(QName elementQName) throws OMException {
+ public OMElement getFirstChildWithName(QName elementQName) throws OMException {
OMChildrenQNameIterator omChildrenQNameIterator =
- new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
- elementQName);
+ new OMChildrenQNameIterator((OMNodeImpl) getFirstChild(),
+ elementQName);
OMNode omNode = null;
if (omChildrenQNameIterator.hasNext()) {
omNode = (OMNode) omChildrenQNameIterator.next();
}
- return omNode;
+
+ return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ? (OMElement) omNode : null;
+
}
/**
@@ -253,7 +252,7 @@
OMNodeImpl firstChildImpl = (OMNodeImpl) firstChild;
firstChildImpl.setPreviousSibling(child);
}
- this.setFirstChild(child);
+ this.firstChild = child;
}
/**
@@ -292,15 +291,6 @@
return declareNamespace(ns);
}
- /**
- * Method setValue
- *
- * @param value
- */
- public void setValue(String value) {
- OMText txt = OMFactory.newInstance().createText(value);
- this.addChild(txt);
- }
/**
* @param namespace
@@ -325,7 +315,7 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public OMNamespace findInScopeNamespace(String uri, String prefix)
+ public OMNamespace findNamespace(String uri, String prefix)
throws OMException {
// check in the current element
@@ -336,7 +326,7 @@
// go up to check with ancestors
if (parent != null) {
- return ((OMElement)parent).findInScopeNamespace(uri, prefix);
+ return parent.findNamespace(uri, prefix);
}
return null;
}
@@ -350,7 +340,7 @@
* @return
* @throws OMException
*/
- public OMNamespace findDeclaredNamespace(String uri, String prefix)
+ private OMNamespace findDeclaredNamespace(String uri, String prefix)
throws OMException {
if (namespaces == null) {
return null;
@@ -390,7 +380,7 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public OMAttribute getAttributeWithQName(QName qname) throws OMException {
+ public OMAttribute getFirstAttribute(QName qname) throws OMException {
if (attributes == null) {
return null;
}
@@ -404,25 +394,16 @@
*/
public Iterator getAttributes() {
if (attributes == null) {
- return new Iterator(){
-
- public void remove() {
- throw new UnsupportedOperationException();
-
- }
-
- public boolean hasNext() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public Object next() {
- throw new UnsupportedOperationException();
- }
- };
+ return new EmptyIterator();
}
return attributes.values().iterator();
}
+ public Iterator getAttributes(QName qname) {
+ //would there be multiple attributes with the same QName
+ return null; //ToDO
+ }
+
/**
* This will insert attribute to this element. Implementor can decide as to insert this
* in the front or at the end of set of attributes
@@ -430,7 +411,7 @@
* @param attr
* @return
*/
- public OMAttribute insertAttribute(OMAttribute attr) {
+ public OMAttribute addAttribute(OMAttribute attr) {
if (attributes == null) {
this.attributes = new HashMap(5);
}
@@ -450,27 +431,27 @@
}
/**
- * Method insertAttribute
+ * Method addAttribute
*
* @param attributeName
* @param value
* @param ns
* @return
*/
- public OMAttribute insertAttribute(String attributeName, String value,
- OMNamespace ns) {
+ public OMAttribute addAttribute(String attributeName, String value,
+ OMNamespace ns) {
OMNamespace namespace = null;
if (ns != null) {
- namespace = findInScopeNamespace(ns.getName(), ns.getPrefix());
+ 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 insertAttribute(new OMAttributeImpl(attributeName, ns, value));
+ return addAttribute(new OMAttributeImpl(attributeName, ns, value));
}
/**
@@ -525,12 +506,13 @@
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public void detach() throws OMException {
- if (done) {
+ public OMNode detach() throws OMException {
+ if (!done){
+ build();
+ }else{
super.detach();
- } else {
- builder.discard(this);
}
+ return this;
}
/**
@@ -543,48 +525,78 @@
}
/**
- * This will return the literal value of the node.
- * OMText --> the text
- * OMElement --> local name of the element in String format
- * OMAttribute --> the value of the attribue
+ * This is to get the type of node, as this is the super class of all the nodes
*
* @return
* @throws org.apache.axis.om.OMException
* @throws OMException
*/
- public String getValue() throws OMException {
- throw new UnsupportedOperationException();
+ public int getType() throws OMException {
+ return OMNode.ELEMENT_NODE;
}
/**
- * This is to get the type of node, as this is the super class of all the nodes
- *
+ * @see org.apache.axis.om.OMElement#getXMLStreamReader()
* @return
- * @throws org.apache.axis.om.OMException
- * @throws OMException
*/
- public short getType() throws OMException {
- return OMNode.ELEMENT_NODE;
+ public XMLStreamReader getXMLStreamReader() {
+ return getXMLStreamReader(true);
+ }
+
+ /**
+ * @see org.apache.axis.om.OMElement#getXMLStreamReaderWithoutCaching()
+ * @return
+ */
+ public XMLStreamReader getXMLStreamReaderWithoutCaching() {
+ return getXMLStreamReader(false);
}
/**
- * @param cacheOff
+ * @param cache
* @return
*/
- public XMLStreamReader getPullParser(boolean cacheOff) {
- if ((builder == null) && cacheOff) {
+ private XMLStreamReader getXMLStreamReader(boolean cache) {
+ if ((builder == null) && !cache) {
throw new UnsupportedOperationException(
"This element was not created in a manner to be switched");
}
- return new OMStAXWrapper(builder, this, cacheOff);
+ return new OMStAXWrapper(builder, this, cache);
+ }
+
+ /**
+ * Sets the text of the given element.
+ * caution - This method will wipe out all the text elements (and hence any
+ * moxed content) before setting the text
+ * @param text
+ */
+ public void setText(String text) {
+
+ OMNode child = this.getFirstChild();
+ while(child != null){
+ if(child.getType() == OMNode.TEXT_NODE){
+ child.detach();
+ }
+ child = child.getNextSibling();
+ }
+
+ this.addChild(OMAbstractFactory.getOMFactory().createText(this,text));
}
+ /**
+ * select all the text children and concat them to a single string
+ * @return
+ */
public String getText() {
String childText = "";
OMNode child = this.getFirstChild();
+ OMText textNode = null;
+
while(child != null){
- if(child.getType() == OMNode.TEXT_NODE && child.getValue() != null && !"".equals(child.getValue().trim())){
- childText += child.getValue().trim();
+ if(child.getType() == OMNode.TEXT_NODE){
+ textNode = (OMText)child;
+ if( textNode.getText() != null && !"".equals(textNode.getText().trim())){
+ childText += textNode.getText().trim();
+ }
}
child = child.getNextSibling();
}
@@ -593,15 +605,21 @@
}
/**
- * Method serialize
+ * Method serializeWithCache
*
* @param writer
- * @param cache
* @throws XMLStreamException
*/
- public void serialize(XMLStreamWriter writer, boolean cache)
- throws XMLStreamException {
- boolean firstElement = false;
+ public void serializeWithCache(XMLStreamWriter writer) throws XMLStreamException {
+ serialize(writer,true);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////////////////////
+
+ private void serialize(XMLStreamWriter writer,boolean cache)throws XMLStreamException {
+
+ // select the builder
short builderType = PULL_TYPE_BUILDER; // default is pull type
if (builder != null) {
builderType = this.builder.getBuilderType();
@@ -610,238 +628,65 @@
&& (builder.getRegisteredContentHandler() == null)) {
builder.registerExternalContentHandler(
new StreamWriterToContentHandlerConverter(writer));
-
- // for now only SAX
- }
-
- // Special case for the pull type building with cache off
- // The getPullParser method returns the current elements itself.
- if (!cache) {
- if ((firstChild == null) && (nextSibling == null) && !isComplete()
- && (builderType == PULL_TYPE_BUILDER)) {
- StreamingOMSerializer streamingOMSerializer =
- new StreamingOMSerializer();
- streamingOMSerializer.serialize(this.getPullParser(!cache),
- writer);
- return;
- }
}
- if (!cache) {
- if (isComplete()) {
-
- // serialize own normally
- serializeNormal(writer, cache);
- if (nextSibling != null) {
-
- // serilize next sibling
- nextSibling.serialize(writer, cache);
- } else {
- if (parent == null) {
- return;
- } else if (((OMElement)parent).isComplete()) {
- return;
- } else {
-
- // do the special serialization
- // Only the push serializer is left now
- builder.setCache(cache);
- builder.next();
- }
- }
- } else if (firstChild != null) {
- if (!(this instanceof OMDocument)) {
- serializeStartpart(writer);
- log.info("Serializing the Element from " + localName
- + " the generated OM tree");
- }
- firstChild.serialize(writer, cache);
- if (!(this instanceof OMDocument)) {
- serializeEndpart(writer);
- }
- } else {
-
- // do the special serilization
- // Only the push serializer is left now
- builder.setCache(cache);
- if (!(this instanceof OMDocument)) {
- serializeStartpart(writer);
- }
- builder.next();
- if (!(this instanceof OMDocument)) {
- serializeEndpart(writer);
- }
- }
- } else {
- // serialize own normally
- serializeNormal(writer, cache);
- // serialize the siblings if this is not the first element
- if (!firstElement) {
- OMNode nextSibling = this.getNextSibling();
- if (nextSibling != null) {
- nextSibling.serialize(writer, cache);
+ if (!cache) {
+ //No caching
+ if (this.firstChild!=null){
+ OMSerializerUtil.serializeStartpart(this,writer);
+ firstChild.serialize(writer);
+ OMSerializerUtil.serializeEndpart(writer);
+ }else if (!this.done){
+ if (builderType==PULL_TYPE_BUILDER){
+ OMSerializerUtil.serializeByPullStream(this,writer);
+ }else{
+ OMSerializerUtil.serializeStartpart(this,writer);
+ builder.setCache(cache);
+ builder.next();
+ OMSerializerUtil.serializeEndpart(writer);
}
+ }else{
+ OMSerializerUtil.serializeNormal(this,writer, cache);
}
- }
- }
-
- /**
- * This was requested during the second Axis2 summit. When one call this method, this will
- * serialise without building the object structure in the memory. Misuse of this method will cause loss of data.
- * So its adviced to use populateYourSelf() method, before this, if you want to preserve data in the stream.
- * @param writer
- * @throws XMLStreamException
- */
- public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- this.serialize(writer, false);
- }
-
-
- /**
- * Method serializeStartpart
- *
- * @param writer
- * @throws XMLStreamException
- */
- private void serializeStartpart(XMLStreamWriter writer)
- throws XMLStreamException {
- String nameSpaceName = null;
- String writer_prefix = null;
- String prefix = null;
- if (ns != null) {
- nameSpaceName = ns.getName();
- writer_prefix = writer.getPrefix(nameSpaceName);
- prefix = ns.getPrefix();
- if (nameSpaceName != null) {
- if (writer_prefix != null) {
- writer.writeStartElement(nameSpaceName,
- this.getLocalName());
- } else {
- if (prefix != null) {
- writer.writeStartElement(prefix, this.getLocalName(),
- nameSpaceName);
- writer.writeNamespace(prefix, nameSpaceName);
- writer.setPrefix(prefix, nameSpaceName);
- } else {
- writer.writeStartElement(nameSpaceName,
- this.getLocalName());
- writer.writeDefaultNamespace(nameSpaceName);
- writer.setDefaultNamespace(nameSpaceName);
- }
+ //serilize siblings
+ if (this.nextSibling!=null){
+ nextSibling.serialize(writer);
+ }else if (this.parent!=null){
+ if (!this.parent.done){
+ builder.setCache(cache);
+ builder.next();
}
- } else {
- writer.writeStartElement(this.getLocalName());
-// throw new OMException(
-// "Non namespace qualified elements are not allowed");
- }
- } else {
- writer.writeStartElement(this.getLocalName());
-// throw new OMException(
-// "Non namespace qualified elements are not allowed");
- }
-
- // add the elements attributes
- if (attributes != null) {
- Iterator attributesList = attributes.values().iterator();
- while (attributesList.hasNext()) {
- serializeAttribute((OMAttribute) attributesList.next(), writer);
}
- }
-
- // add the namespaces
- Iterator namespaces = this.getAllDeclaredNamespaces();
- if (namespaces != null) {
- while (namespaces.hasNext()) {
- serializeNamespace((OMNamespace) namespaces.next(), writer);
+ }else{
+ //Cached
+ OMSerializerUtil.serializeNormal(this,writer, cache);
+ // serialize the siblings
+ OMNode nextSibling = this.getNextSibling();
+ if (nextSibling != null) {
+ nextSibling.serializeWithCache(writer);
}
}
}
- /**
- * Method serializeEndpart
- *
- * @param writer
- * @throws XMLStreamException
- */
- private void serializeEndpart(XMLStreamWriter writer)
- throws XMLStreamException {
- writer.writeEndElement();
- }
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Method serializeNormal
- *
+ * This was requested during the second Axis2 summit. When one call this method, this will
+ * serialise without building the object structure in the memory. Misuse of this method will
+ * cause loss of data.So its adviced to use populateYourSelf() method, before this,
+ * if you want to preserve data in the stream.
* @param writer
- * @param cache
* @throws XMLStreamException
*/
- private void serializeNormal(XMLStreamWriter writer, boolean cache)
- throws XMLStreamException {
- if (!(this instanceof OMDocument)) {
- serializeStartpart(writer);
- }
- OMNode firstChild = getFirstChild();//todo
- if (firstChild != null) {
- firstChild.serialize(writer, cache);
- }
- if (!(this instanceof OMDocument)) {
- serializeEndpart(writer);
- }
+ public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+ this. serialize(writer,false);
}
- /**
- * Method serializeAttribute
- *
- * @param attr
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)
- throws XMLStreamException {
-
- // 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
- */
- protected void serializeNamespace(
- OMNamespace namespace, XMLStreamWriter writer)
- throws XMLStreamException {
- 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);
- }
- }
- }
/**
* Method getNextNamespacePrefix
@@ -864,20 +709,20 @@
return null;
}
- /* (non-Javadoc)
- * @see org.apache.axis.om.OMElement#getNextSiblingElement()
- */
- public OMElement getNextSiblingElement() throws OMException {
- OMNode node = getNextSibling();
- while(node != null){
- if(node.getType() == OMNode.ELEMENT_NODE){
- return (OMElement)node;
- }else{
- node = node.getNextSibling();
- }
- }
- return null;
- }
+// /* (non-Javadoc)
+// * @see org.apache.axis.om.OMElement#getNextSiblingElement()
+// */
+// public OMElement getNextSiblingElement() throws OMException {
+// OMNode node = getNextSibling();
+// while(node != null){
+// if(node.getType() == OMNode.ELEMENT_NODE){
+// return (OMElement)node;
+// }else{
+// node = node.getNextSibling();
+// }
+// }
+// return null;
+// }
/**
@@ -906,7 +751,7 @@
*/
public OMNamespace getNamespace() throws OMException {
if ((ns == null) && (parent != null)) {
- ns = ((OMElement)parent).getNamespace();
+ ns = parent.getNamespace();
}
if (ns == null) {
throw new OMException("all elements in a soap message must be namespace qualified");
@@ -914,17 +759,6 @@
return ns;
}
- /**
- * Method getNamespaceName
- *
- * @return
- */
- public String getNamespaceName() {
- if (ns != null) {
- return ns.getName();
- }
- return null;
- }
/**
* @param namespace
@@ -950,13 +784,14 @@
}
/**
- * This will completely parse this node and build the object structure in the memory
+ * Discard implementation for
* @throws OMException
*/
- public void populateYourSelf() throws OMException {
- while(!done){
- builder.next();
+ public void discard() throws OMException {
+ if (done){
+ this.detach();
+ }else{
+ builder.discard(this);
}
}
-
}
Modified: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMNavigator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMNavigator.java?rev=179795&r1=179794&r2=179795&view=diff
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMNavigator.java (original)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/OMNavigator.java Fri Jun 3 07:23:47 2005
@@ -17,7 +17,7 @@
package org.apache.axis.om.impl.llom;
import org.apache.axis.om.OMElement;
- import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMNode;
/**
* Refer to the testClass to find out how to use
@@ -132,7 +132,7 @@
}
} else {
OMNode nextSibling = ((OMNodeImpl) next).nextSibling;
- OMNode parent = (OMNode)next.getParent();
+ OMNode parent = next.getParent();
if (nextSibling != null) {
next = nextSibling;
} else if ((parent != null) && parent.isComplete()) {