axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r263992 - in /webservices/axis/trunk/java/modules/xml/src/org/apache/axis2: om/impl/llom/ om/impl/llom/builder/ soap/impl/llom/ soap/impl/llom/builder/
Date Mon, 29 Aug 2005 02:02:25 GMT
Author: dims
Date: Sun Aug 28 19:02:21 2005
New Revision: 263992

URL: http://svn.apache.org/viewcvs?rev=263992&view=rev
Log:
- Better handling for the pre-defined "xml" namespace.
- Better handling of nulls returned by getNamespaceURI in sjsxp parser.

NOTE: there are still a few more failures in sjsxp, am working on it.


Modified:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPConstants.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java?rev=263992&r1=263991&r2=263992&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMElementImpl.java
Sun Aug 28 19:02:21 2005
@@ -20,6 +20,7 @@
 import org.apache.axis2.om.impl.llom.traverse.OMChildrenIterator;
 import org.apache.axis2.om.impl.llom.traverse.OMChildrenQNameIterator;
 import org.apache.axis2.om.impl.llom.util.EmptyIterator;
+import org.apache.axis2.soap.impl.llom.SOAPConstants;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -288,7 +289,7 @@
      *
      * @throws OMException
      */
-    public OMNamespace findNamespace(String uri, String prefix)
+    public OMNamespace  findNamespace(String uri, String prefix)
             throws OMException {
 
         // check in the current element
@@ -303,10 +304,17 @@
             //declarations, so going up the parent chain till the document
             //element should be enough.
             if (parent instanceof OMElement) {
-                return ((OMElementImpl) parent).findNamespace(uri, prefix);
+                namespace = ((OMElementImpl) parent).findNamespace(uri, prefix);
             }
         }
-        return null;
+
+        if (namespace == null && uri != null && prefix != null
+                && prefix.equals(SOAPConstants.XMLNS_PREFIX)
+                && uri.equals(SOAPConstants.XMLNS_URI)) {
+            declareNamespace(SOAPConstants.XMLNS_URI, SOAPConstants.XMLNS_PREFIX);
+            namespace = findNamespace(uri, prefix);
+        }
+        return namespace;
     }
 
     /**

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java?rev=263992&r1=263991&r2=263992&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMSerializerUtil.java
Sun Aug 28 19:02:21 2005
@@ -118,27 +118,19 @@
                     writer.writeStartElement(nameSpaceName,
                             element.getLocalName());
                 } else {
-                    if (prefix != null) {
-                        writer.writeStartElement(prefix, element.getLocalName(),
-                                nameSpaceName);
-                        writer.writeNamespace(prefix, nameSpaceName);
-                        writer.setPrefix(prefix, nameSpaceName);
-                    } else {
-                        writer.writeStartElement(nameSpaceName,
-                                element.getLocalName());
-                        writer.writeDefaultNamespace(nameSpaceName);
-                        writer.setDefaultNamespace(nameSpaceName);
+                    if (prefix == null) {
+                        prefix = "";
                     }
+                    writer.writeStartElement(prefix, element.getLocalName(),
+                            nameSpaceName);
+                    writer.writeNamespace(prefix, nameSpaceName);
+                    writer.setPrefix(prefix, nameSpaceName);
                 }
             } else {
                 writer.writeStartElement(element.getLocalName());
-//                throw new OMException(
-//                        "Non namespace qualified elements are not allowed");
             }
         } else {
             writer.writeStartElement(element.getLocalName());
-//            throw new OMException(
-//                    "Non namespace qualified elements are not allowed");
         }
 
         // add the elements attributes
@@ -209,8 +201,5 @@
             streamingOMSerializer.serialize(element.getXMLStreamReaderWithoutCaching(),
                 omOutput);
         }
-
-
-        return;
     }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java?rev=263992&r1=263991&r2=263992&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/builder/StAXBuilder.java
Sun Aug 28 19:02:21 2005
@@ -16,6 +16,7 @@
 package org.apache.axis2.om.impl.llom.builder;
 
 import org.apache.axis2.om.*;
+import org.apache.axis2.soap.impl.llom.SOAPConstants;
 
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
@@ -26,12 +27,6 @@
  */
 public abstract class StAXBuilder implements OMXMLParserWrapper {
 
-    private static final String XMLNS_URI =
-        "http://www.w3.org/XML/1998/namespace";
-
-    private static final String XMLNS_PREFIX =
-        "xml";
-
     /**
      * Field parser
      */
@@ -124,13 +119,7 @@
             OMNamespace ns = null;
             String uri = parser.getAttributeNamespace(i);
             String prefix = parser.getAttributePrefix(i);
-            if (uri.hashCode() != 0) {
-                ns = node.findNamespace(uri, prefix);
-            }
-            if (ns == null && prefix != null && uri != null
-                    && prefix.equals(XMLNS_PREFIX)
-                    && uri.equals(XMLNS_URI)) {
-                node.declareNamespace(XMLNS_URI, XMLNS_PREFIX);
+            if (uri != null && uri.hashCode() != 0) {
                 ns = node.findNamespace(uri, prefix);
             }
             // todo if the attributes are supposed to namespace qualified all the time

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPConstants.java?rev=263992&r1=263991&r2=263992&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPConstants.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPConstants.java
Sun Aug 28 19:02:21 2005
@@ -83,4 +83,9 @@
     public static final String FAULT_CODE_RECEIVER = "";
 
 
+    public static final String XMLNS_URI =
+        "http://www.w3.org/XML/1998/namespace";
+
+    public static final String XMLNS_PREFIX =
+        "xml";
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java?rev=263992&r1=263991&r2=263992&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java
Sun Aug 28 19:02:21 2005
@@ -50,7 +50,7 @@
         String namespaceURI = parser.getNamespaceURI();
         String prefix = parser.getPrefix();
         OMNamespace namespace = null;
-        if (!"".equals(namespaceURI)) {
+        if (namespaceURI != null && namespaceURI.length() > 0) {
             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, "");



Mime
View raw message