You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/02/01 14:41:27 UTC

svn commit: r149396 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom: OMElementImpl.java serialize/StreamingOMSerializer.java

Author: ajith
Date: Tue Feb  1 05:41:26 2005
New Revision: 149396

URL: http://svn.apache.org/viewcvs?view=rev&rev=149396
Log:
Fixed a serialization bug

Modified:
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java?view=diff&r1=149395&r2=149396
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMElementImpl.java Tue Feb  1 05:41:26 2005
@@ -442,12 +442,22 @@
     private void serializeStartpart(XMLStreamWriter writer) throws XMLStreamException {
 
         String nameSpaceName = null;
+        String writer_prefix = null;
+        String prefix = null;
 
         if (ns != null) {
             nameSpaceName = ns.getName();
+            writer_prefix = writer.getPrefix(nameSpaceName);
+            prefix = ns.getPrefix();
             if (nameSpaceName != null) {
-                writer.writeStartElement( nameSpaceName, this.getLocalName());
-                serializeNamespace(ns, writer);
+                if (writer_prefix!=null){
+                    writer.writeStartElement(nameSpaceName, this.getLocalName());
+                }else{
+                    writer.writeStartElement(prefix,nameSpaceName, this.getLocalName());
+                    writer.writeNamespace(prefix, nameSpaceName);
+                    writer.setPrefix(prefix,nameSpaceName);
+                }
+
             } else {
                 throw new OMException("Non namespace qualified elements are not allowed");
 

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java?view=diff&r1=149395&r2=149396
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/serialize/StreamingOMSerializer.java Tue Feb  1 05:41:26 2005
@@ -75,20 +75,26 @@
     }
 
     /**
-     
+
      */
     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) {
-            writer.writeStartElement(nameSpaceName ,reader.getLocalName() );
-            serializeNamespace(prefix, nameSpaceName, writer);
+            if (writer_prefix!=null){
+                writer.writeStartElement(nameSpaceName, reader.getLocalName());
+            }else{
+                writer.writeStartElement(prefix,nameSpaceName, reader.getLocalName());
+                writer.writeNamespace(prefix, nameSpaceName);
+                writer.setPrefix(prefix,nameSpaceName);
+            }
         } else {
             throw new OMException("Non namespace qualified elements are not allowed");
         }
-        
+
         //add attributes
         serializeAttributes(reader, writer);
         //add the namespaces
@@ -109,7 +115,7 @@
 //                namespacePrefixStack.pop();
 //        }
         writer.writeEndElement();
-       
+
     }
 
     /**
@@ -154,11 +160,11 @@
     }
 
     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);
-            }
+        String prefix1 = writer.getPrefix(URI);
+        if (prefix1==null) {
+            writer.writeNamespace(prefix, URI);
+            writer.setPrefix(prefix,URI);
+        }
 
     }