ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r202327 - in /webservices/axis/trunk/java: etc/ modules/core/src/org/apache/axis/clientapi/ modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/ modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/ modules/wsdl/src/org/apache/axis/wsd...
Date Wed, 29 Jun 2005 07:36:00 GMT
Author: ajith
Date: Wed Jun 29 00:35:59 2005
New Revision: 202327

URL: http://svn.apache.org/viewcvs?rev=202327&view=rev
Log:
Adding the new databinding components.May still have problems!

Added:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/StreamWrapper.java
Modified:
    webservices/axis/trunk/java/etc/project.xml
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMDocument.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/StaxParserTest.java

Modified: webservices/axis/trunk/java/etc/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/etc/project.xml?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/etc/project.xml (original)
+++ webservices/axis/trunk/java/etc/project.xml Wed Jun 29 00:35:59 2005
@@ -283,7 +283,7 @@
         <report>maven-jxr-plugin</report>
         <report>maven-javadoc-plugin</report>
         <report>maven-junit-report-plugin</report -->
-        <report>maven-clover-plugin</report>
+        <!-- <report>maven-clover-plugin</report> -->
     </reports>
     
 </project>

Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/StreamWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/StreamWrapper.java?rev=202327&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/StreamWrapper.java
(added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/StreamWrapper.java
Wed Jun 29 00:35:59 2005
@@ -0,0 +1,415 @@
+package org.apache.axis.clientapi;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.Location;
+import javax.xml.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+
+/*
+* 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.
+*
+*
+*/
+public class StreamWrapper implements XMLStreamReader{
+
+    private XMLStreamReader realReader = null;
+    private static final int STATE_SWITCHED = 0;
+    private static final int STATE_INIT = 1;
+    private static final int STATE_SWITHC_AT_NEXT = 2;
+
+    private int state = STATE_INIT;
+    private int prevState = state;
+
+    public StreamWrapper(XMLStreamReader realReader) {
+        if (realReader==null){
+            throw new UnsupportedOperationException("Reader cannot be null");
+        }
+        this.realReader = realReader;
+    }
+
+    public Object getProperty(String s) throws IllegalArgumentException {
+        if(prevState!=STATE_INIT){
+            return realReader.getProperty(s);
+        }else{
+            throw new IllegalArgumentException();
+        }
+    }
+
+    public int next() throws XMLStreamException {
+
+        prevState = state;
+
+        if (state==STATE_SWITCHED){
+            return realReader.next();
+        }else if (state==STATE_INIT){
+            if (realReader.getEventType()==START_DOCUMENT){
+                state = STATE_SWITCHED;
+                return  realReader.getEventType();
+            }else{
+                state = STATE_SWITHC_AT_NEXT;
+                return START_DOCUMENT;
+            }
+        }else if (state==STATE_SWITHC_AT_NEXT) {
+            state = STATE_SWITCHED;
+            return realReader.getEventType();
+        }else{
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+    public void require(int i, String s, String s1) throws XMLStreamException {
+        if(prevState!=STATE_INIT){
+            realReader.require(i, s, s1);
+        }
+    }
+
+    public String getElementText() throws XMLStreamException {
+        if(prevState!=STATE_INIT){
+            return realReader.getElementText();
+        }else{
+            throw new XMLStreamException();
+        }
+    }
+
+    public int nextTag() throws XMLStreamException {
+        if(prevState!=STATE_INIT){
+            return realReader.nextTag();
+        }else{
+            throw new XMLStreamException();
+        }
+    }
+
+    public boolean hasNext() throws XMLStreamException {
+        if(prevState!=STATE_INIT){
+            return realReader.hasNext();
+        }else{
+          return true;
+        }
+    }
+
+    public void close() throws XMLStreamException {
+        if(prevState!=STATE_INIT){
+            realReader.close();
+        }else{
+            throw new XMLStreamException();
+        }
+    }
+
+    public String getNamespaceURI(String s) {
+        if(prevState!=STATE_INIT){
+            return realReader.getNamespaceURI(s);
+        }else{
+            return null;
+        }
+    }
+
+    public boolean isStartElement() {
+        if(prevState!=STATE_INIT){
+            return realReader.isStartElement();
+        }else{
+            return false;
+        }
+    }
+
+    public boolean isEndElement() {
+        if(prevState!=STATE_INIT){
+            return realReader.isEndElement();
+        }else{
+            return false;
+        }
+    }
+
+    public boolean isCharacters() {
+        if(prevState!=STATE_INIT){
+            return realReader.isCharacters();
+        }else{
+            return false;
+        }
+    }
+
+    public boolean isWhiteSpace() {
+        if(prevState!=STATE_INIT){
+            return realReader.isWhiteSpace();
+        }else{
+            return false;
+        }
+    }
+
+    public String getAttributeValue(String s, String s1) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeValue(s,s1);
+        }else{
+            return null;
+        }
+    }
+
+    public int getAttributeCount() {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeCount();
+        }else{
+            return 0;
+        }
+    }
+
+    public QName getAttributeName(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeName(i);
+        }else{
+            return null;
+        }
+    }
+
+    public String getAttributeNamespace(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeNamespace(i);
+        }else{
+            return null;
+        }
+    }
+
+    public String getAttributeLocalName(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeLocalName(i);
+        }else{
+            return null;
+        }
+    }
+
+    public String getAttributePrefix(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributePrefix(i);
+        }else{
+            return null;
+        }
+    }
+
+    public String getAttributeType(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeType(i);
+        }else{
+            return null;
+        }
+    }
+
+    public String getAttributeValue(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getAttributeValue(i);
+        }else{
+            return null;
+        }
+    }
+
+    public boolean isAttributeSpecified(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.isAttributeSpecified(i);
+        }else{
+            return false;
+        }
+    }
+
+    public int getNamespaceCount() {
+        if(prevState!=STATE_INIT){
+            return realReader.getNamespaceCount();
+        }else{
+            return 0;
+        }
+    }
+
+    public String getNamespacePrefix(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getNamespacePrefix(i);
+        }else{
+            return null;
+        }
+    }
+
+    public String getNamespaceURI(int i) {
+        if(prevState!=STATE_INIT){
+            return realReader.getNamespaceURI(i);
+        }else{
+            return null;
+        }
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        if(prevState!=STATE_INIT){
+            return realReader.getNamespaceContext();
+        }else{
+            return null;
+        }
+    }
+
+    public int getEventType() {
+        if(prevState==STATE_INIT){
+            return START_DOCUMENT;
+        }else{
+            return realReader.getEventType();
+        }
+    }
+
+    public String getText() {
+        if(prevState!=STATE_INIT){
+            return realReader.getText();
+        }else{
+            return null;
+        }
+    }
+
+    public char[] getTextCharacters() {
+        if(prevState!=STATE_INIT){
+            return realReader.getTextCharacters();
+        }else{
+            return new char[0] ;
+        }
+    }
+
+    public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException
{
+        if(prevState!=STATE_INIT){
+            return realReader.getTextCharacters(i,chars,i1,i2);
+        }else{
+            return 0 ;
+        }
+    }
+
+    public int getTextStart() {
+        if(prevState!=STATE_INIT){
+            return realReader.getTextStart();
+        }else{
+            return 0 ;
+        }
+    }
+
+    public int getTextLength() {
+        if(prevState!=STATE_INIT){
+            return realReader.getTextStart();
+        }else{
+            return 0 ;
+        }
+    }
+
+    public String getEncoding() {
+        if(prevState!=STATE_INIT){
+            return realReader.getEncoding();
+        }else{
+            return null ;
+        }
+    }
+
+    public boolean hasText() {
+        if(prevState!=STATE_INIT){
+            return realReader.hasText();
+        }else{
+            return false ;
+        }
+    }
+
+    public Location getLocation() {
+        if(prevState!=STATE_INIT){
+            return realReader.getLocation();
+        }else{
+            return null ;
+        }
+    }
+
+    public QName getName() {
+        if(prevState!=STATE_INIT){
+            return realReader.getName();
+        }else{
+            return null ;
+        }
+    }
+
+    public String getLocalName() {
+        if(prevState!=STATE_INIT){
+            return realReader.getLocalName();
+        }else{
+            return null ;
+        }
+    }
+
+    public boolean hasName() {
+        if(prevState!=STATE_INIT){
+            return realReader.hasName();
+        }else{
+            return false ;
+        }
+    }
+
+    public String getNamespaceURI() {
+        if(prevState!=STATE_INIT){
+            return realReader.getNamespaceURI();
+        }else{
+            return null ;
+        }
+    }
+
+    public String getPrefix() {
+        if(prevState!=STATE_INIT){
+            return realReader.getPrefix();
+        }else{
+            return null ;
+        }
+    }
+
+    public String getVersion() {
+        if(prevState!=STATE_INIT){
+            return realReader.getVersion();  
+        }else{
+            return null ;
+        }
+    }
+
+    public boolean isStandalone() {
+        if(prevState!=STATE_INIT){
+            return realReader.isStandalone();
+        }else{
+            return false ;
+        }
+    }
+
+    public boolean standaloneSet() {
+        if(prevState!=STATE_INIT){
+            return realReader.standaloneSet();
+        }else{
+            return false ;
+        }
+    }
+
+    public String getCharacterEncodingScheme() {
+        if(prevState!=STATE_INIT){
+            return realReader.getCharacterEncodingScheme();
+        }else{
+            return null ;
+        }
+    }
+
+    public String getPITarget() {
+        if(prevState!=STATE_INIT){
+            return realReader.getPITarget();
+        }else{
+            return null ;
+        }
+    }
+
+    public String getPIData() {
+        if(prevState!=STATE_INIT){
+            return realReader.getPIData();
+        }else{
+            return null ;
+        }
+    }
+}

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
(original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
Wed Jun 29 00:35:59 2005
@@ -555,7 +555,7 @@
             addAttribute(doc,"dbsupportname",localPart+DATABINDING_SUPPORTER_NAME_SUFFIX,methodElement);
             addSOAPAction(doc,methodElement,binding);
             addAttribute(doc, "mep",operation.getMessageExchangePattern(), methodElement);
-            methodElement.appendChild(getInputElement(doc,operation));
+             methodElement.appendChild(getInputElement(doc,operation));
             methodElement.appendChild(getOutputElement(doc,operation));
             rootElement.appendChild(methodElement);
         }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java
(original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java
Wed Jun 29 00:35:59 2005
@@ -62,8 +62,8 @@
                     Element schemaElement = ((Schema)extensiblityElt).getElelment();
 //                    //add the namespaces
                     XmlOptions options = new XmlOptions();
-                    options.setCompileDownloadUrls();
                     options.setLoadAdditionalNamespaces(configuration.getWom().getNamespaces());
+                    //options.
                     xmlObjects[i] = XmlObject.Factory.parse(schemaElement,options);
                 } catch (XmlException e) {
                     throw new RuntimeException(e);

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java
(original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java
Wed Jun 29 00:35:59 2005
@@ -47,17 +47,17 @@
 
     public JavaTypeMapper() {
        //add the basic types to the table 
-       this.map.put(new QName(XSD_SCHEMA_URL,"string"),String.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"boolean"),Boolean.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"double"),Double.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"long"),Long.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"float"),Float.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"int"),Integer.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"short"),Short.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"byte"),Byte.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"decimal"),BigDecimal.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"date"),Date.class.getName());
-       this.map.put(new QName(XSD_SCHEMA_URL,"QName"),QName.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"string"),String.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"boolean"),Boolean.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"double"),Double.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"long"),Long.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"float"),Float.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"int"),Integer.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"short"),Short.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"byte"),Byte.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"decimal"),BigDecimal.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"date"),Date.class.getName());
+//       this.map.put(new QName(XSD_SCHEMA_URL,"QName"),QName.class.getName());
     }
 
     public String toString() {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMDocument.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMDocument.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMDocument.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMDocument.java
Wed Jun 29 00:35:59 2005
@@ -78,7 +78,7 @@
      * @return
      */
     public OMElement getRootElement() {
-        if (rootElement == null) {
+        while (rootElement == null) {
             parserWrapper.next();
         }
         return rootElement;

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
Wed Jun 29 00:35:59 2005
@@ -785,6 +785,10 @@
      * @param namespace
      */
     public void setNamespace(OMNamespace namespace) {
+        OMNamespace ns = this.findNamespace(namespace.getName(), namespace.getPrefix());
+        if (ns == null) {
+            ns = this.declareNamespace(namespace);
+        }
         this.ns = namespace;
     }
 

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
Wed Jun 29 00:35:59 2005
@@ -812,7 +812,12 @@
                 }
                 log.info(
                         "Switching to the Real Stax parser to generated the future events");
-                currentEvent = parser.getEventType();
+
+                if ((currentEvent == START_DOCUMENT) && (currentEvent == parser.getEventType())){
+                    currentEvent = parser.next();
+                } else{
+                    currentEvent = parser.getEventType();
+                }
                 updateCompleteStatus();
                 break;
             case NAVIGABLE:
@@ -1006,9 +1011,9 @@
         switch (nodeType) {
             case OMNode.ELEMENT_NODE:
                 OMElement element = (OMElement) node;
-                log.info("Generating events from element {"
-                                + element.getNamespace().getName() + '}'
-                                + element.getLocalName() + " Generated OM tree");
+//                log.info("Generating events from element {"
+//                                + element.getNamespace().getName() + '}'
+//                                + element.getLocalName() + " Generated OM tree");
                 returnEvent = generateElementEvents(element);
                 break;
             case OMNode.TEXT_NODE:

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/builder/StAXOMBuilder.java
Wed Jun 29 00:35:59 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.impl.llom.builder;
 
 import org.apache.axis.om.*;
@@ -26,18 +26,13 @@
  * This will construct an OM without using SOAP specific classes like SOAPEnvelope, SOAPHeader,
SOAPHeaderBlock and SOAPBody.
  * And this will habe the Document concept also.
  */
-public class StAXOMBuilder extends StAXBuilder implements OMXMLParserWrapper {
+public class StAXOMBuilder extends StAXBuilder{
     /**
      * Field document
      */
     protected OMDocument document;
 
-    /**
-     * Field omFactory
-     */
-    protected OMFactory omFactory;
-
-    /**
+     /**
      * Constructor StAXOMBuilder
      *
      * @param ombuilderFactory
@@ -113,6 +108,10 @@
             if (done) {
                 throw new OMException();
             }
+            ///////////////////////////////////
+//            int token = parser.getEventType();
+            //////////////////////////////////
+
             int token = parser.next();
             if (!cache) {
                 return token;
@@ -122,7 +121,9 @@
                     lastNode = createOMElement();
                     break;
                 case XMLStreamConstants.START_DOCUMENT:
-                    document = new OMDocument(this);
+                    //Don't do anything in the start document event
+                    //We've already assumed that start document has passed!
+                    //document = new OMDocument(this);
                     break;
                 case XMLStreamConstants.CHARACTERS:
                     lastNode = createOMText();
@@ -146,6 +147,9 @@
                 default :
                     throw new OMException();
             }
+            ////////////////////
+           // if (!done) parser.next();
+            ///////////////////
             return token;
         } catch (OMException e) {
             throw e;
@@ -170,16 +174,46 @@
      * @param isSOAPElement
      */
     protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
-        int namespaceCount = parser.getNamespaceCount();
+          int namespaceCount = parser.getNamespaceCount();
         for (int i = 0; i < namespaceCount; i++) {
             node.declareNamespace(parser.getNamespaceURI(i),
                     parser.getNamespacePrefix(i));
         }
 
         // set the own namespace
-        OMNamespace namespace =
-                node.findNamespace(parser.getNamespaceURI(),
-                parser.getPrefix());
-        node.setNamespace(namespace);
+        String namespaceURI = parser.getNamespaceURI();
+        String prefix = parser.getPrefix();
+        OMNamespace namespace = null;
+        if (!"".equals(namespaceURI)) {
+            if (prefix == null) {
+                // this means, this elements has a default namespace or it has inherited
a default namespace from its parent
+                namespace = node.findNamespace(namespaceURI, "");
+                if (namespace == null) {
+                    namespace = node.declareNamespace(namespaceURI, "");
+                }
+            } else {
+                namespace = node.findNamespace(namespaceURI, prefix);
+                if(namespace == null){
+                    node.setNamespace(omfactory.createOMNamespace(namespaceURI, prefix));
+                }else{
+                    node.setNamespace(namespace);
+                }
+            }
+
+        } else {
+            // What to do if namespace URI is not available
+        }
     }
+//        int namespaceCount = parser.getNamespaceCount();
+//        for (int i = 0; i < namespaceCount; i++) {
+//            node.declareNamespace(parser.getNamespaceURI(i),
+//                    parser.getNamespacePrefix(i));
+//        }
+//
+//        // set the own namespace
+//        OMNamespace namespace =
+//                node.findNamespace(parser.getNamespaceURI(),
+//                        parser.getPrefix());
+//        node.setNamespace(namespace);
+//    }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/serialize/StreamingOMSerializer.java
Wed Jun 29 00:35:59 2005
@@ -127,8 +127,8 @@
                 }
             }
         } else {
-            throw new OMException(
-                    "Non namespace qualified elements are not allowed");
+//            throw new OMException(
+//                    "Non namespace qualified elements are not allowed");
         }
 
         // add attributes

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/StaxParserTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/StaxParserTest.java?rev=202327&r1=202326&r2=202327&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/StaxParserTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/StaxParserTest.java Wed
Jun 29 00:35:59 2005
@@ -4,6 +4,7 @@
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
 import java.io.ByteArrayInputStream;
 
 /*
@@ -28,12 +29,12 @@
     XMLStreamReader parser1;
     XMLStreamReader parser2;
     XMLStreamReader parser3;
-    String xmlDocument = "<purchase-order xmlns=\"http://openuri.org/easypo\">\n" +
-            "  <customer>\n" +
-            "    <name>Gladys Kravitz</name>\n" +
-            "    <address>Anytown, PA</address>\n" +
-            "  </customer>\n" +
-            "  <date>2005-03-06T14:06:12.697+06:00</date>\n" +
+    String xmlDocument = "<purchase-order xmlns=\"http://openuri.org/easypo\">" +
+            "<customer>" +
+            "    <name>Gladys Kravitz</name>" +
+            "    <address>Anytown, PA</address>" +
+            "  </customer>" +
+            "  <date>2005-03-06T14:06:12.697+06:00</date>" +
             "</purchase-order>";
 
     public StaxParserTest(String testName) {
@@ -46,11 +47,11 @@
 
         OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getSOAP11Factory(),
                 XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xmlDocument.getBytes())));
-        parser2 = builder.getDocumentElement().getXMLStreamReaderWithoutCaching();
+        parser2 = builder.getDocumentElement().getXMLStreamReader();
 
         OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getSOAP11Factory(),
                 XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xmlDocument.getBytes())));
-        parser3 = builder2.getDocumentElement().getXMLStreamReader();
+        parser3 = builder2.getDocumentElement().getXMLStreamReaderWithoutCaching();
 
     }
 
@@ -59,9 +60,11 @@
         assertEquals(parser1.getEventType(),parser2.getEventType());
 
         while(parser1.hasNext()){
-            int parser1Event = parser1.next();
-            int parser2Event = parser2.next();
-            assertEquals(parser1Event,parser2Event);
+
+                int parser1Event = parser1.next();
+                int parser2Event = parser2.next();
+                assertEquals(parser1Event,parser2Event);
+
         }
 
 



Mime
View raw message