axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ven...@apache.org
Subject svn commit: r165108 [6/6] - in /webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance: ./ XMLConformanceTestingProject/ XMLConformanceTestingProject/bin/ XMLConformanceTestingProject/src/ XMLConformanceTestingProject/src/org/ XMLConformanceTestingProject/src/org/apache/ XMLConformanceTestingProject/src/org/apache/axis/ XMLConformanceTestingProject/src/org/apache/axis/om/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/builder/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/exception/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/ XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/util/ XMLConformanceTestingProject/test/ XMLConformanceTestingProject/test/junittesting/
Date Thu, 28 Apr 2005 06:42:28 GMT
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMLinkedListImplFactory.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/factory/OMLinkedListImplFactory.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMLinkedListImplFactory.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMLinkedListImplFactory.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,327 @@
+/*
+ * 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.factory;
+
+import org.apache.axis.om.OMComment;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMPI;
+import org.apache.axis.om.OMDTD;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPFault;
+import org.apache.axis.om.SOAPHeader;
+import org.apache.axis.om.SOAPHeaderBlock;
+import org.apache.axis.om.impl.llom.OMDocument;
+import org.apache.axis.om.impl.llom.OMCommentImpl;
+import org.apache.axis.om.impl.llom.OMElementImpl;
+import org.apache.axis.om.impl.llom.OMNamespaceImpl;
+import org.apache.axis.om.impl.llom.OMPIImpl;
+import org.apache.axis.om.impl.llom.OMDTDImpl;
+import org.apache.axis.om.impl.llom.OMTextImpl;
+import org.apache.axis.om.impl.llom.SOAPBodyImpl;
+import org.apache.axis.om.impl.llom.SOAPEnvelopeImpl;
+import org.apache.axis.om.impl.llom.SOAPFaultImpl;
+import org.apache.axis.om.impl.llom.SOAPHeaderBlockImpl;
+import org.apache.axis.om.impl.llom.SOAPHeaderImpl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class OMLinkedListImplFactory
+ */
+public class OMLinkedListImplFactory extends OMFactory {
+    /**
+     * Field MAX_TO_POOL
+     */
+    public static final int MAX_TO_POOL = 100;
+
+    /**
+     * Method createOMElement
+     *
+     * @param localName
+     * @param ns
+     * @return
+     */
+    public OMElement createOMElement(String localName, OMNamespace ns) {
+        OMElementImpl element = new OMElementImpl(localName, ns);
+        return element;
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     * @return
+     */
+    public OMElement createOMElement(String localName, OMNamespace ns,
+                                     OMElement parent,
+                                     OMXMLParserWrapper builder) {
+        OMElementImpl element = new OMElementImpl(localName, ns, parent,
+                builder);
+        return element;
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @param localName
+     * @param namespaceURI
+     * @param namespacePrefix
+     * @return
+     */
+    public OMElement createOMElement(String localName, String namespaceURI,
+                                     String namespacePrefix) {
+        return this.createOMElement(localName,
+                this.createOMNamespace(namespaceURI,
+                        namespacePrefix));
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @param qname
+     * @param parent
+     * @return
+     * @throws OMException
+     */
+    public OMElement createOMElement(QName qname, OMElement parent)
+            throws OMException {
+        return new OMElementImpl(qname, parent);
+    }
+    
+    /**
+     * Method createOMDTD
+     * 
+     * @param parent
+     * @param content
+     * @return
+     */
+    /* */
+     //Actually this implementation is just a makeshift implementation of DTD.
+     //No validation checking, no processing of contents whatsoever. Just would
+     //capture all of the contents as text and wrap it as a OMDTD node.
+     public OMDTD createOMDTD(OMDocument parent, String content) {
+     	OMDTDImpl omDTD = new OMDTDImpl((OMElement)parent, content);
+     	return omDTD;
+     }
+    /**/
+
+    /**
+     * Method createOMPI
+     *
+     * @param parent
+     * @param piTarget
+     * @param piData
+     * @return
+     */
+    public OMPI createOMPI(OMElement parent, String piTarget, String piData) {
+    	OMPIImpl omPI = new OMPIImpl(parent, piTarget, piData);
+    	return omPI;
+    }
+
+    /**
+     * Method createOMNamespace
+     *
+     * @param uri
+     * @param prefix
+     * @return
+     */
+    public OMNamespace createOMNamespace(String uri, String prefix) {
+        return new OMNamespaceImpl(uri, prefix);
+    }
+
+    /**
+     * Method createText
+     *
+     * @param parent
+     * @param text
+     * @return
+     */
+    public OMText createText(OMElement parent, String text) {
+        OMTextImpl textNode = new OMTextImpl(parent, text);
+        return textNode;
+    }
+    
+    /**
+     * Method createOMComment
+     *
+     * @param parent
+     * @param content
+     * @return
+     */
+    public OMComment createOMComment(OMElement parent, String content) throws OMException{
+    	OMCommentImpl commentNode = new OMCommentImpl(parent,content);
+    	return commentNode;
+    }
+
+    /**
+     * Method createText
+     *
+     * @param s
+     * @return
+     */
+    public OMText createText(String s) {
+        OMTextImpl textNode = new OMTextImpl(s);
+    ;
+        return textNode;
+    }
+
+    /**
+     * Method createSOAPBody
+     *
+     * @param envelope
+     * @return
+     */
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope) {
+        SOAPBody soapBody = new SOAPBodyImpl(envelope);
+        return soapBody;
+    }
+
+    /**
+     * Method createSOAPBody
+     *
+     * @param envelope
+     * @param builder
+     * @return
+     */
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+                                   OMXMLParserWrapper builder) {
+        return new SOAPBodyImpl(envelope, builder);
+    }
+
+    /**
+     * Method createSOAPEnvelope
+     *
+     * @param ns
+     * @param builder
+     * @return
+     */
+    public SOAPEnvelope createSOAPEnvelope(OMNamespace ns,
+                                           OMXMLParserWrapper builder) {
+        return new SOAPEnvelopeImpl(ns, builder);
+    }
+
+    /**
+     * Method createSOAPEnvelope
+     *
+     * @param ns
+     * @return
+     */
+    public SOAPEnvelope createSOAPEnvelope(OMNamespace ns) {
+        return new SOAPEnvelopeImpl(ns);
+    }
+
+    /**
+     * Method createSOAPHeader
+     *
+     * @param envelope
+     * @return
+     */
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) {
+        return new SOAPHeaderImpl(envelope);
+    }
+
+    /**
+     * Method createSOAPHeader
+     *
+     * @param envelope
+     * @param builder
+     * @return
+     */
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+                                       OMXMLParserWrapper builder) {
+        return new SOAPHeaderImpl(envelope, builder);
+    }
+
+    /**
+     * Method createSOAPHeaderBlock
+     *
+     * @param localName
+     * @param ns
+     * @return
+     */
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns) {
+        return new SOAPHeaderBlockImpl(localName, ns);
+    }
+
+    /**
+     * Method createSOAPHeaderBlock
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     * @return
+     */
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns, OMElement parent, OMXMLParserWrapper builder) {
+        return new SOAPHeaderBlockImpl(localName, ns, parent, builder);
+    }
+
+    /**
+     * Method createSOAPFault
+     *
+     * @param parent
+     * @param e
+     * @return
+     */
+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e) {
+        return new SOAPFaultImpl(parent, e);
+    }
+
+    /**
+     * Method createSOAPFault
+     *
+     * @param ns
+     * @param parent
+     * @param builder
+     * @return
+     */
+    public SOAPFault createSOAPFault(OMNamespace ns, SOAPBody parent,
+                                     OMXMLParserWrapper builder) {
+        return new SOAPFaultImpl(ns, parent, builder);
+    }
+
+    /**
+     * Method getDefaultEnvelope
+     *
+     * @return
+     */
+    public SOAPEnvelope getDefaultEnvelope() {
+        // Create an envelope
+        OMNamespace ns =
+        new OMNamespaceImpl(OMConstants.SOAP_ENVELOPE_NAMESPACE_URI,
+                OMConstants.SOAPENVELOPE_NAMESPACE_PREFIX);
+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns);
+        SOAPBodyImpl bodyImpl = new SOAPBodyImpl(env);
+        env.addChild(bodyImpl);
+
+        SOAPHeaderImpl headerImpl = new SOAPHeaderImpl(env);
+        headerImpl.setComplete(true);
+        env.addChild(headerImpl);
+        return env;
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMXMLBuilderFactory.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/factory/OMXMLBuilderFactory.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMXMLBuilderFactory.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/factory/OMXMLBuilderFactory.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,71 @@
+/*
+ * 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.factory;
+
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis.om.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Class OMXMLBuilderFactory
+ */
+public class OMXMLBuilderFactory {
+    /**
+     * Field PARSER_XPP
+     */
+    public static final String PARSER_XPP = "XPP";
+
+    /**
+     * Field PARSER_STAX
+     */
+    public static final String PARSER_STAX = "StAX";
+
+    /**
+     * Field MODEL_SOAP_SPECIFIC
+     */
+    public static final String MODEL_SOAP_SPECIFIC = "SOAP_SPECIFIC";
+
+    /**
+     * Field MODEL_OM
+     */
+    public static final String MODEL_OM = "OM_ONLY";
+
+    /**
+     * Method createStAXSOAPModelBuilder
+     *
+     * @param ombuilderFactory
+     * @param parser
+     * @return
+     */
+    public static StAXSOAPModelBuilder createStAXSOAPModelBuilder(
+            OMFactory ombuilderFactory, XMLStreamReader parser) {
+        return new StAXSOAPModelBuilder(ombuilderFactory, parser);
+    }
+
+    /**
+     * Method createStAXOMBuilder
+     *
+     * @param ombuilderFactory
+     * @param parser
+     * @return
+     */
+    public static StAXOMBuilder createStAXOMBuilder(OMFactory ombuilderFactory,
+                                                    XMLStreamReader parser) {
+        return new StAXOMBuilder(ombuilderFactory, parser);
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.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/serialize/StreamWriterToContentHandlerConverter.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamWriterToContentHandlerConverter.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,229 @@
+/*
+ * 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.serialize;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Class StreamWriterToContentHandlerConverter
+ */
+public class StreamWriterToContentHandlerConverter implements ContentHandler {
+    /**
+     * Field log
+     */
+    private Log log = LogFactory.getLog(getClass());
+
+    /**
+     * Field writer
+     */
+    private XMLStreamWriter writer;
+
+    /**
+     * Constructor StreamWriterToContentHandlerConverter
+     *
+     * @param writer
+     */
+    public StreamWriterToContentHandlerConverter(XMLStreamWriter writer) {
+        this.writer = writer;
+    }
+
+    /**
+     * Method endDocument
+     *
+     * @throws SAXException
+     */
+    public void endDocument() throws SAXException {
+
+        // do nothing
+    }
+
+    /**
+     * Method startDocument
+     *
+     * @throws SAXException
+     */
+    public void startDocument() throws SAXException {
+
+        // 
+    }
+
+    /**
+     * Method characters
+     *
+     * @param ch
+     * @param start
+     * @param length
+     * @throws SAXException
+     */
+    public void characters(char ch[], int start, int length)
+            throws SAXException {
+        try {
+            writer.writeCharacters(ch, start, length);
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+
+    /**
+     * Method ignorableWhitespace
+     *
+     * @param ch
+     * @param start
+     * @param length
+     * @throws SAXException
+     */
+    public void ignorableWhitespace(char ch[], int start, int length)
+            throws SAXException {
+
+        // throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method endPrefixMapping
+     *
+     * @param prefix
+     * @throws SAXException
+     */
+    public void endPrefixMapping(String prefix) throws SAXException {
+
+        // throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method skippedEntity
+     *
+     * @param name
+     * @throws SAXException
+     */
+    public void skippedEntity(String name) throws SAXException {
+
+        // throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method setDocumentLocator
+     *
+     * @param locator
+     */
+    public void setDocumentLocator(Locator locator) {
+
+        // throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method processingInstruction
+     *
+     * @param target
+     * @param data
+     * @throws SAXException
+     */
+    public void processingInstruction(String target, String data)
+            throws SAXException {
+
+        // throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method startPrefixMapping
+     *
+     * @param prefix
+     * @param uri
+     * @throws SAXException
+     */
+    public void startPrefixMapping(String prefix, String uri)
+            throws SAXException {
+        try {
+            writer.writeNamespace(prefix, uri);
+            writer.setPrefix(prefix, uri);
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+
+    /**
+     * Method endElement
+     *
+     * @param namespaceURI
+     * @param localName
+     * @param qName
+     * @throws SAXException
+     */
+    public void endElement(String namespaceURI, String localName, String qName)
+            throws SAXException {
+        try {
+            writer.writeEndElement();
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+
+    /**
+     * Method getPrefix
+     *
+     * @param qName
+     * @return
+     */
+    private String getPrefix(String qName) {
+        if (qName != null) {
+            return qName.substring(0, qName.indexOf(":"));
+        }
+        return null;
+    }
+
+    /**
+     * Method startElement
+     *
+     * @param namespaceURI
+     * @param localName
+     * @param qName
+     * @param atts
+     * @throws SAXException
+     */
+    public void startElement(
+            String namespaceURI, String localName, String qName, Attributes atts)
+            throws SAXException {
+        try {
+            log.info("writing element {" + namespaceURI + '}' + localName
+                            + " directly to stream ");
+            String prefix = getPrefix(qName);
+
+            // it is only the prefix we want to learn from the QName! so we can get rid of the
+            // spliting QName
+            if (prefix == null) {
+                writer.writeStartElement(namespaceURI, localName);
+            } else {
+                writer.writeStartElement(prefix, localName, namespaceURI);
+            }
+            if (atts != null) {
+                int attCount = atts.getLength();
+                for (int i = 0; i < attCount; i++) {
+                    writer.writeAttribute(atts.getURI(i), localName,
+                            atts.getValue(i));
+                }
+            }
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.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/serialize/StreamingOMSerializer.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,230 @@
+/*
+ * 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.serialize;
+
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMSerializer;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Class StreamingOMSerializer
+ */
+public class StreamingOMSerializer implements XMLStreamConstants, OMSerializer {
+
+    /*
+     * The behavior of the serializer is such that it returns when it encounters the
+     * starting element for the second time. The depth variable tracks the depth of the
+     * serilizer and tells it when to return.
+     * Note that it is assumed that this serilization starts on an Element
+     */
+
+    /**
+     * Field depth
+     */
+    private int depth = 0;
+
+    /**
+     * Method serialize
+     *
+     * @param obj
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void serialize(Object obj, XMLStreamWriter writer)
+            throws XMLStreamException {
+        if (!(obj instanceof XMLStreamReader)) {
+            throw new UnsupportedOperationException(
+                    "Unsupported input object. Must be of the the type XMLStreamReader");
+        }
+        XMLStreamReader node = (XMLStreamReader) obj;
+        serializeNode(node, writer);
+    }
+
+    /**
+     * Method serializeNode
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        while (reader.hasNext()) {
+            int event = reader.next();
+            if (event == START_ELEMENT) {
+                serializeElement(reader, writer);
+                depth++;
+            } else if (event == ATTRIBUTE) {
+                serializeAttributes(reader, writer);
+            } else if (event == CHARACTERS) {
+                serializeText(reader, writer);
+            } else if (event == COMMENT) {
+                serializeComment(reader, writer);
+            } else if (event == CDATA) {
+                serializeCData(reader, writer);
+            } else if (event == END_ELEMENT) {
+                serializeEndElement(writer);
+                depth--;
+            } else if (event == END_DOCUMENT) {
+                try {
+                    serializeEndElement(writer);
+                } catch (Exception e) {
+                    //TODO: log exceptions
+                }
+            }
+            if (depth == 0) {
+                break;
+            }
+        }
+    }
+
+    /**
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeElement(
+            XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        String prefix = reader.getPrefix();
+        String nameSpaceName = reader.getNamespaceURI();
+        String writer_prefix = writer.getPrefix(nameSpaceName);
+        if (nameSpaceName != null) {
+            if (writer_prefix != null) {
+                writer.writeStartElement(nameSpaceName, reader.getLocalName());
+            } else {
+                if (prefix != null) {
+                    writer.writeStartElement(prefix, reader.getLocalName(),
+                            nameSpaceName);
+                    writer.writeNamespace(prefix, nameSpaceName);
+                    writer.setPrefix(prefix, nameSpaceName);
+                } else {
+                    writer.writeStartElement(nameSpaceName,
+                            reader.getLocalName());
+                    writer.writeDefaultNamespace(nameSpaceName);
+                    writer.setDefaultNamespace(nameSpaceName);
+                }
+            }
+        } else {
+            throw new OMException(
+                    "Non namespace qualified elements are not allowed");
+        }
+
+        // add attributes
+        serializeAttributes(reader, writer);
+
+        // add the namespaces
+        int count = reader.getNamespaceCount();
+        for (int i = 0; i < count; i++) {
+            serializeNamespace(reader.getNamespacePrefix(i),
+                    reader.getNamespaceURI(i), writer);
+        }
+    }
+
+    /**
+     * Method serializeEndElement
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeEndElement(XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeEndElement();
+    }
+
+    /**
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeCharacters(reader.getText());
+    }
+
+    /**
+     * Method serializeCData
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeCData(
+            XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeCData(reader.getText());
+    }
+
+    /**
+     * Method serializeComment
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeComment(
+            XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeComment(reader.getText());
+    }
+
+    /**
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeAttributes(
+            XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        int count = reader.getAttributeCount();
+        String prefix = null;
+        String namespaceName = null;
+        for (int i = 0; i < count; i++) {
+            prefix = reader.getAttributePrefix(i);
+            namespaceName = reader.getAttributeNamespace(i);
+            if ((prefix != null) && !namespaceName.equals("")) {
+                writer.writeAttribute(prefix, namespaceName,
+                        reader.getAttributeLocalName(i),
+                        reader.getAttributeValue(i));
+            } else {
+                writer.writeAttribute(reader.getAttributeLocalName(i),
+                        reader.getAttributeValue(i));
+            }
+        }
+    }
+
+    /**
+     * Method serializeNamespace
+     *
+     * @param prefix
+     * @param URI
+     * @param writer
+     * @throws XMLStreamException
+     */
+    private void serializeNamespace(
+            String prefix, String URI, XMLStreamWriter writer)
+            throws XMLStreamException {
+        String prefix1 = writer.getPrefix(URI);
+        if (prefix1 == null) {
+            writer.writeNamespace(prefix, URI);
+            writer.setPrefix(prefix, URI);
+        }
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenIterator.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/traverse/OMChildrenIterator.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenIterator.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenIterator.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,115 @@
+/*
+ * 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.traverse;
+
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMNode;
+
+import java.util.Iterator;
+
+/**
+ * Class OMChildrenIterator
+ */
+public class OMChildrenIterator implements Iterator {
+    /**
+     * Field currentChild
+     */
+    protected OMNode currentChild;
+
+    /**
+     * Field lastChild
+     */
+    protected OMNode lastChild;
+
+    /**
+     * Field nextCalled
+     */
+    protected boolean nextCalled = false;
+
+    /**
+     * Field removeCalled
+     */
+    protected boolean removeCalled = false;
+
+    /**
+     * Constructor OMChildrenIterator
+     *
+     * @param currentChild
+     */
+    public OMChildrenIterator(OMNode currentChild) {
+        this.currentChild = currentChild;
+    }
+
+    /**
+     * Removes from the underlying collection the last element returned by the
+     * iterator (optional operation).  This method can be called only once per
+     * call to <tt>next</tt>.  The behavior of an iterator is unspecified if
+     * the underlying collection is modified while the iteration is in
+     * progress in any way other than by calling this method.
+     *
+     * @throws UnsupportedOperationException if the <tt>remove</tt>
+     *                                       operation is not supported by this Iterator.
+     * @throws IllegalStateException         if the <tt>next</tt> method has not
+     *                                       yet been called, or the <tt>remove</tt> method has already
+     *                                       been called after the last call to the <tt>next</tt>
+     *                                       method.
+     */
+    public void remove() {
+        if (!nextCalled) {
+            throw new IllegalStateException(
+                    "next method has not yet being called");
+        }
+        if (removeCalled) {
+            throw new IllegalStateException("remove has already being called");
+        }
+        removeCalled = true;
+
+        // since this acts on the last child there is no need to mess with the current child
+        if (lastChild == null) {
+            throw new OMException("cannot remove a child at this stage!");
+        }
+        lastChild.detach();
+    }
+
+    /**
+     * Returns <tt>true</tt> if the iteration has more elements. (In other
+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element
+     * rather than throwing an exception.)
+     *
+     * @return <tt>true</tt> if the iterator has more elements.
+     */
+    public boolean hasNext() {
+        return (currentChild != null);
+    }
+
+    /**
+     * Returns the next element in the iteration.
+     *
+     * @return the next element in the iteration.
+     * @throws java.util.NoSuchElementException
+     *          iteration has no more elements.
+     */
+    public Object next() {
+        nextCalled = true;
+        removeCalled = false;
+        if (hasNext()) {
+            lastChild = currentChild;
+            currentChild = currentChild.getNextSibling();
+            return lastChild;
+        }
+        return null;
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.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/traverse/OMChildrenQNameIterator.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,135 @@
+/*
+ * 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.traverse;
+
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.impl.llom.OMElementImpl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class OMChildrenQNameIterator
+ */
+public class OMChildrenQNameIterator extends OMChildrenIterator {
+    /**
+     * Field givenQName
+     */
+    private QName givenQName;
+
+    /**
+     * Field needToMoveForward
+     */
+    private boolean needToMoveForward = true;
+
+    /**
+     * Field isMatchingNodeFound
+     */
+    private boolean isMatchingNodeFound = false;
+
+    /**
+     * Constructor OMChildrenQNameIterator
+     *
+     * @param currentChild
+     * @param givenQName
+     */
+    public OMChildrenQNameIterator(OMNode currentChild, QName givenQName) {
+        super(currentChild);
+        this.givenQName = givenQName;
+    }
+
+    /**
+     * Returns <tt>true</tt> if the iteration has more elements. (In other
+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element
+     * rather than throwing an exception.)
+     *
+     * @return <tt>true</tt> if the iterator has more elements.
+     */
+    public boolean hasNext() {
+        while (needToMoveForward) {
+            if (currentChild != null) {
+
+                // check the current node for the criteria
+                if ((currentChild instanceof OMElementImpl)
+                        && (isQNamesMatch(
+                                   ((OMElementImpl) currentChild).getQName(),
+                                   this.givenQName))) {
+                    isMatchingNodeFound = true;
+                    needToMoveForward = false;
+                } else {
+
+                    // get the next named node
+                    currentChild = currentChild.getNextSibling();
+                    isMatchingNodeFound = needToMoveForward = !(currentChild
+                                                                           == null);
+                }
+            } else {
+                needToMoveForward = false;
+            }
+        }
+        return isMatchingNodeFound;
+    }
+
+    /**
+     * Returns the next element in the iteration.
+     *
+     * @return the next element in the iteration.
+     * @throws java.util.NoSuchElementException
+     *          iteration has no more elements.
+     */
+    public Object next() {
+
+        // reset the flags
+        needToMoveForward = true;
+        isMatchingNodeFound = false;
+        nextCalled = true;
+        removeCalled = false;
+        lastChild = currentChild;
+        currentChild = currentChild.getNextSibling();
+        return lastChild;
+    }
+
+    /**
+     * Here I can not use the overriden equals method of QName, as one might want to get
+     * some element just by giving the localname, even though a matching element has a namespace uri as well.
+     * This will not be supported in the equals method of the QName
+     *
+     * @param elementQName
+     * @param qNameToBeMatched
+     * @return
+     */
+    private boolean isQNamesMatch(QName elementQName, QName qNameToBeMatched) {
+
+        // if no QName was given, that means one needs all
+        if (qNameToBeMatched == null) {
+            return true;
+        }
+
+        // if the given localname is null, whatever value this.qname has, its a match
+        boolean localNameMatch =
+        (qNameToBeMatched.getLocalPart() == null)
+                || (qNameToBeMatched.getLocalPart() == "")
+                || ((elementQName != null)
+                               && elementQName.getLocalPart().equalsIgnoreCase(
+                                       qNameToBeMatched.getLocalPart()));
+        boolean namespaceURIMatch =
+        (qNameToBeMatched.getNamespaceURI() == null)
+                || (qNameToBeMatched.getNamespaceURI() == "")
+                || ((elementQName != null)
+                               && elementQName.getNamespaceURI().equalsIgnoreCase(
+                                       qNameToBeMatched.getNamespaceURI()));
+        return localNameMatch && namespaceURIMatch;
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenWithSpecificAttributeIterator.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/traverse/OMChildrenWithSpecificAttributeIterator.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenWithSpecificAttributeIterator.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/traverse/OMChildrenWithSpecificAttributeIterator.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,112 @@
+/*
+ * 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.traverse;
+
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNode;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class OMChildrenWithSpecificAttributeIterator
+ */
+public class OMChildrenWithSpecificAttributeIterator
+        extends OMChildrenIterator {
+    /**
+     * Field attributeName
+     */
+    private QName attributeName;
+
+    /**
+     * Field attributeValue
+     */
+    private String attributeValue;
+
+    /**
+     * Field detach
+     */
+    private boolean detach;
+
+    /**
+     * Constructor OMChildrenWithSpecificAttributeIterator
+     *
+     * @param currentChild
+     * @param attributeName
+     * @param attributeValue
+     * @param detach
+     */
+    public OMChildrenWithSpecificAttributeIterator(OMNode currentChild,
+                                                   QName attributeName, String attributeValue, boolean detach) {
+        super(currentChild);
+        this.attributeName = attributeName;
+        this.attributeValue = attributeValue;
+        this.detach = detach;
+    }
+
+    /**
+     * Method hasNext
+     *
+     * @return
+     */
+    public boolean hasNext() {
+
+        // First check whether we have a child, using the super class
+        if (currentChild == null) {
+            return false;
+        }
+        boolean isMatchingNodeFound = false;
+        boolean needToMoveForward = true;
+
+        // now we have a child to check. If its an OMElement and matches the criteria, then we are done
+        while (needToMoveForward) {
+
+            // check the current node for the criteria
+            if (currentChild instanceof OMElement) {
+                OMAttribute attr =
+                        ((OMElement) currentChild).getAttributeWithQName(
+                        attributeName);
+                if ((attr != null)
+                        && attr.getValue().equalsIgnoreCase(attributeValue)) {
+                    isMatchingNodeFound = true;
+                    needToMoveForward = false;
+                } else {
+                    currentChild = currentChild.getNextSibling();
+                    needToMoveForward = !(currentChild == null);
+                }
+            } else {
+
+                // get the next named node
+                currentChild = currentChild.getNextSibling();
+                needToMoveForward = !(currentChild == null);
+            }
+        }
+        return isMatchingNodeFound;
+    }
+
+    /**
+     * Method next
+     *
+     * @return
+     */
+    public Object next() {
+        Object o = super.next();
+        if ((o != null) && detach) {
+            ((OMElement) o).detach();
+        }
+        return o;
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/src/org/apache/axis/om/impl/llom/util/XMLComparator.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/util/XMLComparator.java?rev=165108&view=auto
==============================================================================
--- 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/impl/llom/util/XMLComparator.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,142 @@
+package org.apache.axis.om.impl.llom.util;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.impl.llom.exception.XMLComparisonException;
+import org.apache.axis.om.impl.llom.exception.XMLComparisonException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Iterator;
+
+/**
+ * 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 XMLComparator {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    private Log log = LogFactory.getLog(getClass());
+
+
+    public boolean compare(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+        if(elementOne == null && elementTwo == null){
+            log.info("Both Elements are null.");
+            return true;
+        }
+        if(elementOne == null && elementTwo != null){
+            throw new XMLComparisonException("Element One is null and Element Two is not null");
+        }
+        if(elementOne != null && elementTwo == null){
+            throw new XMLComparisonException("Element Two is null and Element One is not null");
+        }
+
+        log.info("Now Checking "+ elementOne.getLocalName() + " and " + elementTwo.getLocalName() + "=============================");
+
+        log.info("Comparing Element Names .......");
+        compare("Elements names are not equal. ", elementOne.getLocalName(), elementTwo.getLocalName());
+
+        log.info("Comparing Namespaces .........");
+        compare("Element namespaces are not equal", elementOne.getNamespace(), elementTwo.getNamespace());
+
+        log.info("Comparing attributes .....");
+        compareAllAttributes(elementOne, elementTwo);
+
+        log.info("Comparing texts .....");
+        compare("Elements texts are not equal ", elementOne.getText(), elementTwo.getText());
+
+        log.info("Comparing Children ......");
+        compareAllChildren(elementOne, elementTwo);
+
+
+        return true;
+    }
+
+    private void compareAllAttributes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+        compareAttibutes(elementOne, elementTwo);
+        compareAttibutes(elementTwo, elementOne);
+    }
+
+    private void compareAllChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+        compareChildren(elementOne, elementTwo);
+        compareChildren(elementTwo, elementOne);
+    }
+
+    private void compareChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+        Iterator elementOneChildren = elementOne.getChildren();
+        while (elementOneChildren.hasNext()) {
+            OMNode omNode = (OMNode) elementOneChildren.next();
+            if(omNode instanceof OMElement){
+                OMElement elementOneChild = (OMElement) omNode;
+                OMNode elementTwoChild = elementTwo.getChildWithName(elementOneChild.getQName());
+                if(elementTwoChild == null){
+                    throw new XMLComparisonException(" There is no " + elementOneChild.getLocalName() + " element under " + elementTwo.getLocalName());
+                }
+                compare(elementOneChild, (OMElement) elementTwoChild);
+            }
+        }
+    }
+
+
+    private void compareAttibutes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {
+        int elementOneAtribCount = 0;
+        int elementTwoAtribCount = 0;
+        Iterator attributes = elementOne.getAttributes();
+        while (attributes.hasNext()) {
+            OMAttribute omAttribute = (OMAttribute) attributes.next();
+            OMAttribute attr = elementTwo.getAttributeWithQName(omAttribute.getQName());
+            if(attr == null){
+                throw new XMLComparisonException("Attributes are not the same in two elements. Attribute "+ omAttribute.getLocalName() + " != ");
+            }
+            elementOneAtribCount++;
+        }
+
+        Iterator elementTwoIter = elementTwo.getAttributes();
+        while (elementTwoIter.hasNext()) {
+           elementTwoIter.next();
+            elementTwoAtribCount++;
+
+        }
+
+        if(elementOneAtribCount != elementTwoAtribCount){
+             throw new XMLComparisonException("Attributes are not the same in two elements.");
+        }
+    }
+
+    private void compare(String failureNotice, String one, String two) throws XMLComparisonException {
+        if(!one.equals(two)){
+            throw new XMLComparisonException(failureNotice+ one + " != " + two);
+        }
+    }
+
+    private void compare(String failureNotice, OMNamespace one, OMNamespace two) throws XMLComparisonException {
+        if(one == null && two == null){
+            return;
+        }else if(one != null && two == null){
+            throw new XMLComparisonException("First Namespace is NOT null. But the second is null");
+        }else if(one == null && two != null){
+            throw new XMLComparisonException("First Namespace is null. But the second is NOT null");
+        }
+
+        if(!one.getName().equals(two.getName())){
+            throw new XMLComparisonException(failureNotice + one + " != " + two);
+        }
+
+        // Do we need to compare prefixes as well
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/junittesting/XMLConformanceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/junittesting/XMLConformanceTest.java?rev=165108&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/junittesting/XMLConformanceTest.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLConformanceTestingProject/test/junittesting/XMLConformanceTest.java Wed Apr 27 23:42:26 2005
@@ -0,0 +1,140 @@
+/*
+ * Created on Apr 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package junittesting;
+
+import java.io.File;
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.custommonkey.xmlunit.Diff;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis.om.impl.llom.OMDocument;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import org.apache.axis.om.OMFactory;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileInputStream;
+
+
+/**
+ * @author sunja07
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XMLConformanceTest extends XMLTestCase {
+
+	private static int successCount=0;
+	private static int parsedCount=0;
+	private static int fileCount=0;
+	/**
+	 * @param name
+	 */
+	public XMLConformanceTest(String name) {
+		super(name);
+	}
+	
+	public void setUp() {		
+	}
+	
+	public void testXMLConformance() throws Exception{
+		File testSuiteDirectory = new File("C:\\Documents and Settings\\sunja07\\Desktop\\XMLConformanceWork\\XMLSuite");
+		//The following line is for checking any individual file behaviour rather than whole suite
+		//File testSuiteDirectory = new File("C:\\Documents and Settings\\sunja07\\Desktop\\XMLConformanceWork\\XMLSuite\\xmlconf\\ibm\\valid\\P10\\ibm10v05.xml");
+		ProcessDir(testSuiteDirectory);
+		System.out.println("File count is " + fileCount);
+		System.out.println("Parsed count is " + parsedCount +". This is just partial success");
+		System.out.println("Complete success count is " + successCount);
+	}
+	
+	public void ProcessDir(File dir) throws Exception
+	{
+		if (dir.isDirectory()) {
+			//System.out.println("Processing Directory: "+dir.getAbsolutePath() );
+			String[] children = dir.list();
+			for (int i=0; i<children.length; i++) {
+	           File child = (new File(dir, children[i]));	           
+	           	ProcessDir(child);
+	           }
+	    } else { //meaning you got a file
+           	//check if it's xml file
+           	String absPath = dir.getAbsolutePath();
+           	if(absPath.endsWith(".xml")) {
+           		//process it
+           		testSingleFileConformance(absPath);
+           		if((fileCount++)%100 == 0) //|| fileCount == 1000 || fileCount == 1500 || fileCount == 2000)
+    			{
+    				System.out.println("This line is just for pausing the stdout log and copying it\n");
+    			}
+    	        
+           	} else {
+           		//ignore non .xml files
+           	}
+        }		
+	}
+	
+	public void testSingleFileConformance(String absolutePath) throws Exception{
+		OMElement rootElement;
+		OMDocument document;
+		//fileCount++;
+		//get a stax om builder
+		try {
+		StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder(OMFactory.newInstance(), XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(absolutePath) , "UTF-8"));
+
+		document = (OMDocument)staxOMBuilder.getDocument();
+		rootElement = staxOMBuilder.getDocumentElement();
+		} catch (Exception e) {
+			System.err.println("Exception trying to get hold of rootElement: " + e.getMessage());
+			System.err.println("in file: "+ absolutePath +"\n");
+			return;
+		}		
+
+		//we will write output into the file named TempOutputFile.txt in current directory
+		String tempFile = "TempOutputFile.txt";
+		XMLStreamWriter writer;
+		try {
+		writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(new FileOutputStream(tempFile));		
+		document.serialize(writer, true); 
+//        rootElement.serialize(writer, true);
+		}catch(XMLStreamException e) {
+			System.err.println("Error in creating XMLStreamWriter to write parsed xml into");
+			return;
+		} catch (Exception e) {
+			System.err.println("Exception while serializing: " + e.getMessage());
+			System.err.println("in file: "+ absolutePath +"\n");
+			return;
+		}
+        writer.flush();
+        writer.close();        
+        parsedCount++;
+        //Comparing the equality of the TempOutputFile.txt and the input xml is due
+        /* */
+        Diff diff;
+        try {
+        diff = compareXML(new FileReader(absolutePath), new FileReader("TempOutputFile.txt"));
+        } catch (Exception e) {
+        	System.out.println("Error comparing original and generated files for: "+absolutePath);
+        	System.out.println("Error message is: "+e.getMessage());
+        	return;
+        }
+        try {
+        	assertXMLEqual(diff,true);
+        	successCount++;
+        } catch (Error e) {
+        	System.out.println("XMLEquality failed for file: "+absolutePath);        	
+        	return;
+        }
+        
+	}
+	public void tearDown() {		
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLSuite.zip
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLSuite.zip?rev=165108&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/xml_conformance/XMLSuite.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message