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 2005/11/10 04:01:04 UTC

svn commit: r332212 - in /webservices/axis2/trunk/c/modules: test/om/src/ xml/om/src/

Author: samisa
Date: Wed Nov  9 19:00:48 2005
New Revision: 332212

URL: http://svn.apache.org/viewcvs?rev=332212&view=rev
Log:
made some changed to om code and corrected test_om.c , patch applied 

Modified:
    webservices/axis2/trunk/c/modules/test/om/src/test.xml
    webservices/axis2/trunk/c/modules/test/om/src/test_om.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c

Modified: webservices/axis2/trunk/c/modules/test/om/src/test.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/om/src/test.xml?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/om/src/test.xml (original)
+++ webservices/axis2/trunk/c/modules/test/om/src/test.xml Wed Nov  9 19:00:48 2005
@@ -1,7 +1,6 @@
 <?xml version="1.0" ?>
-
 <book xmlns:axiomc="http://ws.apache.org/axis2/c/om" xmlns:isbn="urn:ISBN:0-395-74341-6">
-	<axiomc:title>Axis2/C OM HOWTO</axiomc:title>
+	<axiomc:title>Axis2C OM HOWTO</axiomc:title>
 	<isbn:number>1748491379</isbn:number>
 	<author title="Mr" name="Axitoc Oman"/>
     <a>   </a>

Modified: webservices/axis2/trunk/c/modules/test/om/src/test_om.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/om/src/test_om.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/om/src/test_om.c (original)
+++ webservices/axis2/trunk/c/modules/test/om/src/test_om.c Wed Nov  9 19:00:48 2005
@@ -1,4 +1,4 @@
-#include <axis2_om_stax_builder.h>
+    #include <axis2_om_stax_builder.h>
 #include <axis2_om_document.h>
 #include <axis2_om_node.h>
 #include <axis2_om_element.h>
@@ -8,7 +8,6 @@
 #include <guththila_xml_pull_parser.h>
 
 axis2_allocator_t *allocator = NULL;
-axis2_string_t *string = NULL;
 axis2_env_t *environment = NULL;
 
 guththila_environment_t *my_guththila_environment = NULL;
@@ -22,88 +21,95 @@
     guththila_xml_pull_parser_t *parser = NULL;
     axis2_om_element_t *ele1 = NULL, *ele2 = NULL, *ele3 = NULL, *ele4 = NULL;
     axis2_om_stax_builder_t *builder = NULL;
+    axis2_om_text_t *text = NULL;
     axis2_om_document_t *document = NULL;
     axis2_om_node_t *node1 = NULL, *node2 = NULL, *node3 = NULL;
     FILE *fp = NULL;
     axis2_om_output_t *om_output = NULL;
+    axis2_om_namespace_t* ns = NULL;
 
     fp = fopen (file_name, "r");
-
+  
+   
     reader = guththila_reader_create (my_guththila_environment, fp);
 
     parser =
         guththila_xml_pull_parser_create (my_guththila_environment, reader);
 
     guththila_xml_pull_parser_read (my_guththila_environment, parser);
-
-    if (!fp)
-    {
-        printf ("Read Failed");
-    }
-
-    builder =
-        axis2_om_stax_builder_create (environment, parser,
+ 
+    
+    builder = axis2_om_stax_builder_create (&environment, parser,
                                       my_guththila_environment);
-    document = axis2_om_document_create (environment, NULL, builder);
-    printf ("START: pull document\n");
-    node1 = axis2_om_document_get_root_element (environment, document);
-    printf ("root localname %s\n",
-            ((axis2_om_element_t *) (node1->data_element))->localname);
-    if (((axis2_om_element_t *) (node1->data_element))->ns)
-        printf ("root ns prefix %s\n",
-                ((axis2_om_element_t *) (node1->data_element))->ns->prefix);
-    if (((axis2_om_element_t *) (node1->data_element))->ns)
-        printf ("root ns uri %s\n",
-                ((axis2_om_element_t *) (node1->data_element))->ns->uri);
-
+           
+    document = axis2_om_document_create (&environment, NULL, builder);
+    node1 = AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT (document,&environment);
+    if(node1)
+    {
+        printf ("NODE TYPE %d\n",AXIS2_OM_NODE_GET_NODE_TYPE(node1,&environment));
+    
+        ele1 =AXIS2_OM_NODE_GET_DATA_ELEMENT(node1,&environment);
+        if(ele1)
+             
+        printf ("root localname %s\n",AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1,&environment));
+         
+        ns = AXIS2_OM_ELEMENT_GET_NAMESPACE(ele1,&environment);
+    
+        if (ns)
+        {
+            printf ("root ns prefix %s\n", AXIS2_OM_NAMESPACE_GET_PREFIX(ns,&environment));
+            printf ("root ns uri %s\n", AXIS2_OM_NAMESPACE_GET_PREFIX(ns,&environment));
 
-    node2 = axis2_om_document_build_next (environment, document);
+        }
+    }
+    
+    node2 = AXIS2_OM_DOCUMENT_BUILD_NEXT( document , &environment);
     do
     {
 
         if (!node2)
             break;
 
-        switch (node2->node_type)
+        switch (AXIS2_OM_NODE_GET_NODE_TYPE(node2,&environment))
         {
         case AXIS2_OM_ELEMENT:
-            if (((axis2_om_element_t *) (node2->data_element))->localname)
-                printf ("Element localname %s\n",
-                        ((axis2_om_element_t *) (node2->data_element))->
-                        localname);
+            ele2 =(axis2_om_element_t*) AXIS2_OM_NODE_GET_DATA_ELEMENT(node2, &environment);
+            if(ele2 && AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment))
+                printf("Element localname %s\n" , AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment)); 
+                        
             break;
         case AXIS2_OM_TEXT:
-            if (((axis2_om_text_t *) (node2->data_element))
-                && ((axis2_om_text_t *) (node2->data_element))->value)
-                printf ("Element Text value %s\n",
-                        ((axis2_om_text_t *) (node2->data_element))->value);
+            
+            text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node2,&environment);    
+            if( text && AXIS2_OM_TEXT_GET_VALUE(text ,&environment))
+                printf("Text value %s \n", AXIS2_OM_TEXT_GET_VALUE(text,&environment));
             break;
 
         default:
             break;
         }
 
-        node2 = axis2_om_document_build_next (environment, document);
+        node2 = AXIS2_OM_DOCUMENT_BUILD_NEXT (document , &environment);
     }
     while (node2);
     printf ("END: pull document\n");
 
     printf ("Serialize pulled document\n");
-    om_output = axis2_om_output_create (environment, NULL, NULL);
-    axis2_om_node_serialize (environment, node1, om_output);
-    axis2_free (environment->allocator, om_output);
-    axis2_om_document_free (environment, document);
-    axis2_om_stax_builder_free (environment, builder);
+   
+    om_output = axis2_om_output_create (&environment, NULL, NULL);
+    AXIS2_OM_NODE_SERIALIZE (node1, &environment , om_output);
+    
+    AXIS2_FREE (environment->allocator, om_output);
+    
+    AXIS2_OM_DOCUMENT_FREE (document, &environment);
+    
+    AXIS2_OM_STAX_BUILDER_FREE ( builder, &environment);
     guththila_xml_pull_parser_free (my_guththila_environment, parser);
-	
+    
     printf ("\n\n");
 }
 
-/*
-<?xml version="1.0" ?>
-<builder xmlns="http://www.wso2.com/"  test="xml"><document>TEST</document><a></a><b></b></builder>
 
-*/
 
 int
 test_om_serialize ()
@@ -120,7 +126,7 @@
        </p>
        </notes>
        </book>
-     */
+    */
     axis2_om_element_t *ele1 = NULL, *ele2 = NULL, *ele3 = NULL, *ele4 =
         NULL, *ele5 = NULL;
     axis2_om_node_t *node1 = NULL, *node2 = NULL, *node3 = NULL, *node4 =
@@ -131,49 +137,42 @@
     axis2_om_output_t *om_output = NULL;
 
     ns1 =
-        axis2_om_namespace_create (environment,
+        axis2_om_namespace_create (&environment,
                                    "http://ws.apache.org/axis2/c/om",
                                    "axiom");
     ns2 =
-        axis2_om_namespace_create (environment, "urn:ISBN:0-395-74341-6",
+        axis2_om_namespace_create (&environment, "urn:ISBN:0-395-74341-6",
                                    "isbn");
     ns3 =
-        axis2_om_namespace_create (environment, "urn:w3-org-ns:HTML", "NULL");
-
-    ele1 = axis2_om_element_create (environment, NULL, "book", ns1, &node1);
-    /*axis2_om_element_declare_namespace(environment, node1, ns2); */
+        axis2_om_namespace_create (&environment, "urn:w3-org-ns:HTML", "NULL");
 
-    ele2 = axis2_om_element_create (environment, node1, "title", ns1, &node2);
-    text1 =
-        axis2_om_text_create (environment, node2, "Axis2/C OM HOWTO", &node3);
-
-    ele3 =
-        axis2_om_element_create (environment, node1, "number", ns2, &node4);
-    text1 = axis2_om_text_create (environment, node4, "1748491379", &node5);
-
-    ele4 =
-        axis2_om_element_create (environment, node1, "author", ns1, &node6);
-    attr1 = axis2_om_attribute_create (environment, "title", "Mr", ns1);
-    axis2_om_element_add_attribute (environment, ele4, attr1);
-    attr2 =
-        axis2_om_attribute_create (environment, "name", "Axitoc Oman", ns1);
-    axis2_om_element_add_attribute (environment, ele4, attr2);
-
-
-    ele2 = axis2_om_element_create (environment, NULL, "notes", ns1, &node2);
-    ele3 = axis2_om_element_create (environment, node2, "p", ns3, &node3);
-    text1 =
-        axis2_om_text_create (environment, node3,
-                              "This is <i>vey good</i> book on OM!", &node4);
-
-    /*ele3 = axis2_om_element_create (NULL, "ele3", ns3 , &node3); */
-    axis2_om_node_add_child (environment, node1, node2);
-
-    /* serializing stuff */
-    om_output = axis2_om_output_create (environment, NULL, NULL);
+    ele1 = axis2_om_element_create (&environment, NULL, "book", ns1, &node1);
+    AXIS2_OM_ELEMENT_DECLARE_NAMESPACE(ele1,&environment,node1,ns2);
+    
+    ele2 = axis2_om_element_create (&environment, node1, "title", ns1, &node2);
+    
+    text1 = axis2_om_text_create (&environment, node2, "Axis2/C OM HOWTO", &node3);
+    
+    ele3 = axis2_om_element_create (&environment, node1, "number", ns2, &node4);
+    
+    text1 = axis2_om_text_create (&environment, node4, "1748491379", &node5);
+    
+    ele4 = axis2_om_element_create (&environment, node1, "author", ns1, &node6);
+    
+    attr1 = axis2_om_attribute_create (&environment, "title", "Mr", ns1);
+    
+    AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(ele4, &environment,attr1);
+    
+    attr2 = axis2_om_attribute_create (&environment, "name", "Axitoc Oman", ns1);
+    
+    AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(ele4,&environment, attr2);
+    
+   
+    /* serializing stuff */ 
+    om_output = axis2_om_output_create (&environment, NULL, NULL);
 
     printf ("Serialize built document\n");
-    int status = axis2_om_node_serialize (environment, node1, om_output);
+    int status = AXIS2_OM_NODE_SERIALIZE (node1,&environment ,om_output);
     if (status != AXIS2_SUCCESS)
     {
         printf ("\naxis2_om_node_serialize failed\n");
@@ -183,10 +182,8 @@
         printf ("\naxis2_om_node_serialize success\n");
     /* end serializing stuff */
 
-    axis2_om_node_free (environment, node1);
-    axis2_free (environment->allocator, om_output);
-
-    printf ("\nDONE\n");
+    
+     printf ("\nDONE\n");
 
     return 0;
 }
@@ -198,8 +195,7 @@
     if (argc > 1)
         file_name = argv[1];
     allocator = axis2_allocator_init (NULL);
-    environment =
-        axis2_env_create (allocator, NULL, NULL, NULL, NULL);
+    environment = axis2_env_create (allocator);
 
     my_guththila_allocator = guththila_allocator_init (NULL);
     my_guththila_environment =
@@ -207,5 +203,7 @@
                                       NULL, NULL);
 
     test_om_build (file_name);
-    test_om_serialize ();
+    test_om_serialize ();    
+    
+    
 }

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c Wed Nov  9 19:00:48 2005
@@ -138,9 +138,18 @@
         AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
         return NULL;
     }
-  /*  attribute->ops->free = axis2_om_attribute_impl_free;
-    attribute->ops->get_qname = axis2_om_attribute_impl_get_qname;
-    attribute->ops->serialize = axis2_om_attribute_impl_serialize; */
+    attribute->om_attribute.ops->free = axis2_om_attribute_free;
+    attribute->om_attribute.ops->get_qname = axis2_om_attribute_get_qname;
+    attribute->om_attribute.ops->serialize = axis2_om_attribute_serialize; 
+    
+    attribute->om_attribute.ops->get_localname = axis2_om_attribute_get_localname;
+    attribute->om_attribute.ops->get_value = axis2_om_attribute_get_value;
+    attribute->om_attribute.ops->get_namespace = axis2_om_attribute_get_namespace;
+    
+    attribute->om_attribute.ops->set_localname = axis2_om_attribute_set_localname;
+    attribute->om_attribute.ops->set_namespace = axis2_om_attribute_set_namespace;
+    attribute->om_attribute.ops->set_value = axis2_om_attribute_set_value;
+    
     return &(attribute->om_attribute);
 }
 
@@ -214,13 +223,13 @@
     attribute = AXIS2_INTF_TO_IMPL(om_attribute);
         
     if (attribute->ns && AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env) && 
-        AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env))
+        AXIS2_OM_NAMESPACE_GET_PREFIX(attribute->ns,env))
     {    
         status = axis2_om_output_write (om_output, env, AXIS2_OM_ATTRIBUTE, 4,
                                         attribute->localname,
                                         attribute->value,
                                         AXIS2_OM_NAMESPACE_GET_URI(attribute->ns, env),
-                                        AXIS2_OM_NAMESPACE_GET_URI(attribute->ns, env));
+                                        AXIS2_OM_NAMESPACE_GET_PREFIX(attribute->ns, env));
     }                                   
     else if (attribute->ns && AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env))
     {
@@ -309,4 +318,4 @@
     }
     AXIS2_INTF_TO_IMPL(om_attribute)->ns = om_namespace;
     return AXIS2_SUCCESS;
-}                                 
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c Wed Nov  9 19:00:48 2005
@@ -140,4 +140,4 @@
     AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(om_comment)->value = (axis2_char_t*)AXIS2_STRDUP(value,env);
     return AXIS2_SUCCESS;
-}                           
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c Wed Nov  9 19:00:48 2005
@@ -147,4 +147,6 @@
 {
     AXIS2_FUNC_PARAM_CHECK(om_doctype, env, NULL);
     return AXIS2_INTF_TO_IMPL(om_doctype)->value;
-}
\ No newline at end of file
+}
+
+

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c Wed Nov  9 19:00:48 2005
@@ -76,18 +76,19 @@
     axis2_om_document_impl_t *document = NULL;
     
     AXIS2_ENV_CHECK(env, NULL);
-
+    
     document = (axis2_om_document_impl_t *) AXIS2_MALLOC (
-                (*env)->allocator, sizeof (axis2_om_document_t));
+                (*env)->allocator, sizeof (axis2_om_document_impl_t));
     
     if (!document)
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY,NULL); 
-
+    
     document->builder = builder;
     document->root_element = root;
     document->first_child = NULL;
     document->last_child = NULL;
-
+   
+   
     document->char_set_encoding = NULL;
     document->char_set_encoding = (axis2_char_t *) AXIS2_STRDUP(CHAR_SET_ENCODING,env);
 
@@ -101,26 +102,26 @@
     document->xml_version = (axis2_char_t *) AXIS2_STRDUP(XML_VERSION,env);
     if (!document->xml_version)
     {
-        AXIS2_FREE((*env)->allocator, document);
+        
         AXIS2_FREE((*env)->allocator, document->char_set_encoding);
+        AXIS2_FREE((*env)->allocator, document);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
     }
-
+    
     document->done = AXIS2_FALSE;
 
-    if (builder)
-        AXIS2_OM_STAX_BUILDER_SET_DOCUMENT (builder, env, &(document->om_document));
+    
 
-    /* operations */
     document->om_document.ops = NULL;
     document->om_document.ops = (axis2_om_document_ops_t *) AXIS2_MALLOC ((*env)->allocator,
                                                   sizeof(axis2_om_document_ops_t));
 
     if (!document->om_document.ops)
     {
-        AXIS2_FREE((*env)->allocator, document);
+        
         AXIS2_FREE((*env)->allocator, document->char_set_encoding);
         AXIS2_FREE((*env)->allocator, document->xml_version);
+        AXIS2_FREE((*env)->allocator, document);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
     }
   
@@ -129,6 +130,10 @@
     document->om_document.ops->build_next = axis2_om_document_build_next;
     document->om_document.ops->get_root_element = axis2_om_document_get_root_element;
     document->om_document.ops->set_root_element = axis2_om_document_set_root_element;
+    
+    if (builder)
+        AXIS2_OM_STAX_BUILDER_SET_DOCUMENT (builder, env, &(document->om_document) );
+    
     return &(document->om_document);
 }
 
@@ -137,6 +142,7 @@
                         axis2_env_t **env)
 {
     axis2_om_document_impl_t *document = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(document, env, AXIS2_FAILURE);
     document = AXIS2_INTF_TO_IMPL(om_document);
     
@@ -144,13 +150,13 @@
         AXIS2_FREE((*env)->allocator, document->char_set_encoding);
     if (document->xml_version)
         AXIS2_FREE((*env)->allocator, document->xml_version);
-
+    
     AXIS2_OM_NODE_FREE(document->root_element, env);
     
     if(document->om_document.ops)
         AXIS2_FREE((*env)->allocator, document->om_document.ops);
 
-    AXIS2_FREE((*env)->allocator, document);
+    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(document));
     return AXIS2_SUCCESS;
 }
 
@@ -183,8 +189,10 @@
                                    axis2_env_t **env)
 {
     axis2_om_document_impl_t *document = NULL;
-    AXIS2_FUNC_PARAM_CHECK(document, env, NULL);
-
+      
+    
+    AXIS2_FUNC_PARAM_CHECK(om_document, env, NULL);
+  
     document = AXIS2_INTF_TO_IMPL(om_document);
     
     if (!(document->root_element))
@@ -202,21 +210,28 @@
 axis2_om_document_get_root_element (axis2_om_document_t * document,
                                     axis2_env_t **env)
 {
-   
     axis2_om_node_t *node = NULL;
     AXIS2_FUNC_PARAM_CHECK(document, env, NULL);
     
     if (AXIS2_INTF_TO_IMPL(document)->root_element)
     {
+        
+        
         return AXIS2_INTF_TO_IMPL(document)->root_element;
     }
     else
-    {
+    {  
         node = axis2_om_document_build_next(document, env);
+            
         if (AXIS2_INTF_TO_IMPL(document)->root_element)
+        {
+            
             return AXIS2_INTF_TO_IMPL(document)->root_element;
+        }
         else
             AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_DOCUMENT_STATE_ROOT_NULL, NULL);
+            
+        
     }
 }
 
@@ -225,8 +240,9 @@
                                    axis2_env_t **env,
                                    axis2_om_node_t *node)
 {
+    
     AXIS2_FUNC_PARAM_CHECK(document, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, node, AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(document)->root_element = node;
     return AXIS2_SUCCESS;
-}                                   
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c Wed Nov  9 19:00:48 2005
@@ -218,6 +218,17 @@
     element->om_element.ops->serialize_end_part =
         axis2_om_element_serialize_end_part;
     
+    element->om_element.ops->set_localname = 
+        axis2_om_element_set_localname;
+    element->om_element.ops->set_namespace =
+        axis2_om_element_set_namespace;
+        
+    element->om_element.ops->get_localname =
+        axis2_om_element_get_localname;
+    
+    element->om_element.ops->get_namespace =
+        axis2_om_element_get_namespace;
+    
     return &(element->om_element);
 
 }
@@ -454,6 +465,7 @@
                                 axis2_env_t **env,
                                 axis2_om_attribute_t *attribute)
 {
+    
     axis2_qname_t *qname = NULL;
     AXIS2_FUNC_PARAM_CHECK(om_element, env, AXIS2_FAILURE);
     if (!attribute)
@@ -466,6 +478,7 @@
 
     if (!(AXIS2_INTF_TO_IMPL(om_element)->attributes))
     {
+        
         AXIS2_INTF_TO_IMPL(om_element)->attributes = axis2_hash_make (env);
         if (!(AXIS2_INTF_TO_IMPL(om_element)->attributes))
             return AXIS2_FAILURE;
@@ -691,15 +704,20 @@
                                axis2_om_node_t *node)
 {
     axis2_om_namespace_t *om_ns = NULL;
-    axis2_status_t status;
+    axis2_status_t status = AXIS2_FAILURE;
     AXIS2_FUNC_PARAM_CHECK(om_element, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error,ns , AXIS2_FAILURE);
+      
     om_ns = axis2_om_element_find_namespace(om_element,env,node,
                                 AXIS2_OM_NAMESPACE_GET_URI(ns, env),
                                 AXIS2_OM_NAMESPACE_GET_PREFIX(ns , env));
-    if(om_ns == NULL)
+    if(!om_ns)
+    {
         status = axis2_om_element_declare_namespace(om_element, env, node, ns);
-    if(status = AXIS2_SUCCESS)
+        AXIS2_INTF_TO_IMPL(om_element)->ns = ns;
+    }
+    else
         AXIS2_INTF_TO_IMPL(om_element)->ns = om_ns;
+    
     return AXIS2_SUCCESS;                                
-}                               
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c Wed Nov  9 19:00:48 2005
@@ -285,4 +285,4 @@
     }
     AXIS2_INTF_TO_IMPL(om_namespace)->prefix = (axis2_char_t*)AXIS2_STRDUP(prefix,env);
     return AXIS2_SUCCESS; 
-}                               
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c Wed Nov  9 19:00:48 2005
@@ -202,6 +202,7 @@
     node->om_node.ops->set_parent = axis2_om_node_set_parent;
     node->om_node.ops->serialize = axis2_om_node_serialize;
     node->om_node.ops->iterator_get_next_child = axis2_om_node_iterator_get_next_child;
+    
     node->om_node.ops->get_first_child = axis2_om_node_get_first_child;
     node->om_node.ops->get_last_child = axis2_om_node_get_last_child;
     node->om_node.ops->get_next_sibling = axis2_om_node_get_next_sibling;
@@ -209,9 +210,12 @@
     node->om_node.ops->get_parent = axis2_om_node_get_parent ;
     node->om_node.ops->get_node_type = axis2_om_node_get_node_type;
     node->om_node.ops->get_build_status = axis2_om_node_get_build_status;
+    node->om_node.ops->get_data_element = axis2_om_node_get_data_element;
+    
+    
+    node->om_node.ops->set_data_element = axis2_om_node_set_data_element;
     node->om_node.ops->set_first_child = axis2_om_node_set_parent;
     node->om_node.ops->set_last_child = axis2_om_node_set_last_child;
-    
     node->om_node.ops->set_previous_sibling = axis2_om_node_set_previous_sibling;
     node->om_node.ops->set_next_sibling = axis2_om_node_set_next_sibling;
     node->om_node.ops->set_first_child = axis2_om_node_set_first_child;
@@ -239,24 +243,26 @@
 
 axis2_status_t AXIS2_CALL axis2_om_node_free(axis2_om_node_t *om_node,axis2_env_t **env)
 {
-
+    printf("node free");
     axis2_om_node_t *child_node = NULL;
       
     AXIS2_FUNC_PARAM_CHECK(om_node,env,AXIS2_FAILURE);
     
-    if ((AXIS2_INTF_TO_IMPL(om_node))->first_child)
+    if (AXIS2_INTF_TO_IMPL(om_node)->first_child)
     {   
         
-        while (((axis2_om_node_impl_t*)om_node)->first_child)
+        while (AXIS2_INTF_TO_IMPL(om_node)->first_child)
         {
             
-            child_node = AXIS2_OM_NODE_DETACH (((axis2_om_node_impl_t*)om_node)->first_child, env);
+            child_node = AXIS2_OM_NODE_DETACH (AXIS2_INTF_TO_IMPL(om_node)->first_child, env);
             AXIS2_OM_NODE_FREE ( child_node , env);
         }
-    }
-    switch (((axis2_om_node_impl_t*)om_node)->node_type)
+    }
+    
+    switch (AXIS2_INTF_TO_IMPL(om_node)->node_type)
     {
-    case AXIS2_OM_ELEMENT:
+    case AXIS2_OM_ELEMENT:
+        printf(" om element free");
         AXIS2_OM_ELEMENT_FREE((axis2_om_element_t*)(AXIS2_INTF_TO_IMPL(om_node)->data_element), env);
         break;
 
@@ -276,9 +282,9 @@
     default:
         break;
     }
-
+    
     AXIS2_FREE ((*env)->allocator, om_node->ops);
-    AXIS2_FREE ((*env)->allocator, om_node);
+    AXIS2_FREE ((*env)->allocator, AXIS2_INTF_TO_IMPL(om_node));
     
 
     return AXIS2_SUCCESS;
@@ -542,12 +548,12 @@
             return status;
         break;
     case AXIS2_OM_TEXT:
-     /*   status =
-            axis2_om_text_serialize (environment,
-                                     (axis2_om_text_t *) om_node->
-                                     data_element, om_output);
+        status = AXIS2_OM_TEXT_SERIALIZE (
+                (axis2_om_text_t*)(AXIS2_INTF_TO_IMPL(om_node)->data_element),
+                env,
+                om_output);
         return status;
-    */      break;
+        break;
     
     default:
         break;
@@ -639,7 +645,7 @@
                                axis2_env_t **env)
 {
     AXIS2_FUNC_PARAM_CHECK(om_node, env, NULL);
-    return AXIS2_INTF_TO_IMPL(om_node);
+    return AXIS2_INTF_TO_IMPL(om_node)->data_element;
 }                                
 
 axis2_status_t AXIS2_CALL  
@@ -717,6 +723,7 @@
                                axis2_env_t **env,
                                void* data_element)
 {                               
+   
     
     AXIS2_FUNC_PARAM_CHECK(om_node, env, AXIS2_FAILURE);
     if(!data_element)
@@ -747,4 +754,4 @@
     AXIS2_FUNC_PARAM_CHECK(om_node, env, AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(om_node)->done = done;
     return AXIS2_SUCCESS;
-}                               
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c Wed Nov  9 19:00:48 2005
@@ -199,4 +199,6 @@
 {
     AXIS2_FUNC_PARAM_CHECK(om_pi, env, NULL);
     return AXIS2_INTF_TO_IMPL(om_pi)->target;
-}                                           
\ No newline at end of file
+}
+
+

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c Wed Nov  9 19:00:48 2005
@@ -92,7 +92,7 @@
     AXIS2_ENV_CHECK(env, NULL);
     
     builder = (axis2_om_stax_builder_impl_t *)AXIS2_MALLOC (
-                (*env)->allocator, sizeof(axis2_om_stax_builder_t));
+                (*env)->allocator, sizeof(axis2_om_stax_builder_impl_t));
 
     if (!builder)
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
@@ -138,7 +138,7 @@
     /* operations */
     builder->om_stax_builder.ops = NULL;
     builder->om_stax_builder.ops = (axis2_om_stax_builder_ops_t *) AXIS2_MALLOC(
-                                    (*env)->allocator, sizeof(axis2_om_stax_builder_t));
+                                    (*env)->allocator, sizeof(axis2_om_stax_builder_ops_t));
 
     if (!builder->om_stax_builder.ops)
     {
@@ -181,10 +181,10 @@
     attribute_count = guththila_xml_pull_parser_get_attribute_count (
                                 om_stax_builder_guththila_environment,
                                 builder->parser);
-                               
-    for (i = 0; i < attribute_count; i++)
+    
+    for (i=1; i <= attribute_count ; i++)
     {
-
+        
         uri =  guththila_xml_pull_parser_get_attribute_namespace_by_number
               (om_stax_builder_guththila_environment, builder->parser, i);
               
@@ -250,12 +250,13 @@
     axis2_om_stax_builder_impl_t *builder = NULL;
    
     AXIS2_FUNC_PARAM_CHECK(om_stax_builder, env, NULL);
-   
+    builder = AXIS2_INTF_TO_IMPL(om_stax_builder);
+    
     if (!builder->lastnode)
         AXIS2_ERROR_SET((*env)->error, 
                          AXIS2_ERROR_INVALID_BUILDER_STATE_LAST_NODE_NULL,NULL);
 
-    builder = AXIS2_INTF_TO_IMPL(om_stax_builder);
+    
     
     temp_value = guththila_xml_pull_parser_get_value (
                     om_stax_builder_guththila_environment, builder->parser);
@@ -435,8 +436,8 @@
     if (!(builder->lastnode))
     {
         axis2_om_element_create (env , NULL, localname, NULL, &element_node);
-        /* should have a way to access documents root_element 
-            without calling build next ????????????????
+        
+        /*
         if (AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(builder->document, env))
              AXIS2_OM_NODE_FREE (
                 AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(builder->document, env),env);*/
@@ -460,9 +461,10 @@
         AXIS2_OM_NODE_SET_FIRST_CHILD(builder->lastnode , env, element_node);                     
         AXIS2_OM_NODE_SET_PARENT(element_node , env, builder->lastnode);
     }
+    
     axis2_om_stax_builder_process_attributes ( om_stax_builder, env, element_node);
     axis2_om_stax_builder_process_namespaces ( om_stax_builder, env, element_node, 0);
-
+    
     builder->lastnode = element_node;
 	
 	/*axis2_free(environment->allocator, localname); */
@@ -506,6 +508,7 @@
 {
     axis2_om_node_t *parent;
     axis2_om_stax_builder_impl_t *builder = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(om_stax_builder, env, AXIS2_FAILURE );
     
     builder = AXIS2_INTF_TO_IMPL(om_stax_builder);
@@ -518,7 +521,7 @@
             if (parent)
             {
                 AXIS2_OM_NODE_SET_BUILD_STATUS(parent, env, AXIS2_TRUE);
-                AXIS2_OM_NODE_SET_PARENT((builder->lastnode), env, parent);
+                builder->lastnode= parent;
             }
         }
         else
@@ -563,12 +566,13 @@
             /*Do nothing */
             break;
         case GUTHTHILA_START_ELEMENT:
-        /*    node = axis2_om_stax_builder_create_om_element (
-                        om_stax_builder, env); */
+           
+           node = axis2_om_stax_builder_create_om_element (
+                        om_stax_builder, env); 
             break;
         case GUTHTHILA_EMPTY_ELEMENT:
-        /*    node = axis2_om_stax_builder_create_om_element (
-                        om_stax_builder, env); */
+            node = axis2_om_stax_builder_create_om_element (
+                        om_stax_builder, env); 
         case GUTHTHILA_END_ELEMENT:
             axis2_om_stax_builder_end_element (om_stax_builder, env);
             break;
@@ -644,8 +648,10 @@
                                     axis2_env_t **env,
                                     axis2_om_document_t *document)
 {
+    
     AXIS2_FUNC_PARAM_CHECK(builder,env,AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, document , AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(builder)->document = document ;
+   
     return AXIS2_SUCCESS;
-}                                     
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c?rev=332212&r1=332211&r2=332212&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c Wed Nov  9 19:00:48 2005
@@ -179,7 +179,5 @@
     AXIS2_PARAM_CHECK((*env)->error , om_text, AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(om_text)->value = (axis2_char_t*)AXIS2_STRDUP(value,env);
     return AXIS2_SUCCESS;
-}                       
-                        
-                        
-                        
\ No newline at end of file
+}
+