You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2007/09/12 08:42:46 UTC

svn commit: r574800 - in /webservices/axis2/trunk/c/axiom: src/om/om_node.c test/om/test_om.c test/resources/xml/om/test.xml

Author: samisa
Date: Tue Sep 11 23:42:45 2007
New Revision: 574800

URL: http://svn.apache.org/viewvc?rev=574800&view=rev
Log:
Fixed the attribute namespace serialize problem in case of serializing sub tree

Modified:
    webservices/axis2/trunk/c/axiom/src/om/om_node.c
    webservices/axis2/trunk/c/axiom/test/om/test_om.c
    webservices/axis2/trunk/c/axiom/test/resources/xml/om/test.xml

Modified: webservices/axis2/trunk/c/axiom/src/om/om_node.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/om/om_node.c?rev=574800&r1=574799&r2=574800&view=diff
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/om/om_node.c (original)
+++ webservices/axis2/trunk/c/axiom/src/om/om_node.c Tue Sep 11 23:42:45 2007
@@ -533,6 +533,7 @@
             if (om_node->data_element)
             {
                 axutil_hash_t *temp_namespaces = NULL;
+                axutil_hash_t *temp_attributes = NULL;
                 axiom_namespace_t *namespace = NULL;
                 status = axiom_element_serialize_start_part(
                     (axiom_element_t *)(om_node->data_element),
@@ -566,7 +567,47 @@
                         }
                     }
                 }
-                
+               
+                temp_attributes = axiom_element_get_all_attributes(
+                    (axiom_element_t *)(om_node->data_element), env);
+                if (temp_attributes)
+                {
+                    axutil_hash_index_t *hi;
+                    void *val;
+                    for (hi = axutil_hash_first(temp_attributes, env); hi;
+                        hi = axutil_hash_next(env, hi))
+                    {
+                        axutil_hash_this(hi, NULL, NULL, &val);
+
+                        if (val)
+                        {
+                            axiom_namespace_t *ns = NULL;
+                            axis2_char_t *prefix = NULL;
+                            
+                            namespace = axiom_attribute_get_namespace((axiom_attribute_t *)val,
+                                env);
+                            
+                            if (namespace)
+                            {
+                                prefix = axiom_namespace_get_prefix(namespace, env);
+                                if (prefix)
+                                {
+                                    ns = axutil_hash_get(namespaces, prefix, AXIS2_HASH_KEY_STRING);
+                                    if (!ns)
+                                    {
+                                        axiom_namespace_serialize(namespace, env, om_output);
+                                        axutil_hash_set(namespaces, prefix, 
+                                            AXIS2_HASH_KEY_STRING, namespace);
+                                    }
+                                }
+                            }
+                        }
+                        else
+                        {
+                            status = AXIS2_FAILURE;
+                        }
+                    }
+                }
             }
             if (status != AXIS2_SUCCESS)
             {

Modified: webservices/axis2/trunk/c/axiom/test/om/test_om.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/test/om/test_om.c?rev=574800&r1=574799&r2=574800&view=diff
==============================================================================
--- webservices/axis2/trunk/c/axiom/test/om/test_om.c (original)
+++ webservices/axis2/trunk/c/axiom/test/om/test_om.c Tue Sep 11 23:42:45 2007
@@ -182,7 +182,7 @@
     buffer = (axis2_char_t*)axiom_xml_writer_get_xml(writer, environment);
 
     if (buffer)
-        printf("%s", buffer);
+        printf("Sub Tree = %s\n", buffer);
 
     axiom_output_free(om_output, environment);
 

Modified: webservices/axis2/trunk/c/axiom/test/resources/xml/om/test.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/test/resources/xml/om/test.xml?rev=574800&r1=574799&r2=574800&view=diff
==============================================================================
--- webservices/axis2/trunk/c/axiom/test/resources/xml/om/test.xml (original)
+++ webservices/axis2/trunk/c/axiom/test/resources/xml/om/test.xml Tue Sep 11 23:42:45 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" ?>
-<axiomc:book xmlns:axiomc="http://ws.apache.org/axis2/c/om" xmlns:isbn="urn:ISBN:0-395-74341-6">
-	<axiomc:title><axiomc:a>Axis2C OM HOWTO</axiomc:a><isbn:number>1748491379</isbn:number></axiomc:title>
+<axiomc:book xmlns:axiomc="http://ws.apache.org/axis2/c/om" xmlns:isbn="urn:ISBN:0-395-74341-6" xmlns:bn="urn:BN">
+	<axiomc:title><axiomc:a bn:test='attr'>Axis2C OM HOWTO</axiomc:a><isbn:number>1748491379</isbn:number></axiomc:title>
 	<isbn:number>1748491379</isbn:number>
 	<author title="Mr" name="Axitoc Oman"/>
     <a>   </a>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org