axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shan...@apache.org
Subject svn commit: r926525 - in /axis/axis2/c/core/trunk/axiom/src: om/axiom_stax_builder_internal.h om/om_document.c om/om_stax_builder.c soap/soap_builder.c
Date Tue, 23 Mar 2010 10:51:35 GMT
Author: shankar
Date: Tue Mar 23 10:51:35 2010
New Revision: 926525

URL: http://svn.apache.org/viewvc?rev=926525&view=rev
Log:
refactor

Modified:
    axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h
    axis/axis2/c/core/trunk/axiom/src/om/om_document.c
    axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c
    axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c

Modified: axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h?rev=926525&r1=926524&r2=926525&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h (original)
+++ axis/axis2/c/core/trunk/axiom/src/om/axiom_stax_builder_internal.h Tue Mar 23 10:51:35
2010
@@ -92,18 +92,7 @@ extern "C"
         struct axiom_stax_builder *builder,
         const axutil_env_t * env);
 
-    /**
-      * Builds the next node from stream. Moves pull parser forward and reacts
-      * to events.
-      * @param builder pointer to stax builder struct to be used
-      * @param environment Environment. MUST NOT be NULL.
-      * @return a pointer to the next node, or NULL if there are no more nodes.
-      *     On erros sets the error and returns NULL.
-      */
-    axiom_node_t *AXIS2_CALL
-    axiom_stax_builder_next(
-        struct axiom_stax_builder *builder,
-        const axutil_env_t * env);
+
 
 #if 0
     /**
@@ -128,6 +117,18 @@ extern "C"
         const axutil_env_t * env,
         axis2_bool_t enable_cache);
 
+    /**
+     * Builds the next node from stream. Moves pull parser forward and reacts
+     * to events.
+     * @param builder pointer to stax builder struct to be used
+     * @param environment Environment. MUST NOT be NULL.
+     * @return a pointer to the next node, or NULL if there are no more nodes.
+     *     On erros sets the error and returns NULL.
+     */
+    axiom_node_t *AXIS2_CALL
+    axiom_stax_builder_next(
+        struct axiom_stax_builder *builder,
+        const axutil_env_t * env);
 
 #endif
 

Modified: axis/axis2/c/core/trunk/axiom/src/om/om_document.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/om_document.c?rev=926525&r1=926524&r2=926525&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/om_document.c (original)
+++ axis/axis2/c/core/trunk/axiom/src/om/om_document.c Tue Mar 23 10:51:35 2010
@@ -89,16 +89,20 @@ axiom_document_get_root_element(
     axiom_document_t * document,
     const axutil_env_t * env)
 {
-    if(document->root_element)
-    {
-        return document->root_element;
-    }
-
-    /* force to build the root node */
-    if(!axiom_stax_builder_next(document->builder, env))
+    if(!document->root_element)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_DOCUMENT_STATE_ROOT_NULL, AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Unable to get root node");
+        /* force to build the root node */
+        int token;
+        do{
+            token = axiom_stax_builder_next_with_token(document->builder, env);
+            if(token == -1)
+            {
+                AXIS2_ERROR_SET(env->error,
+                    AXIS2_ERROR_INVALID_DOCUMENT_STATE_ROOT_NULL, AXIS2_FAILURE);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Unable to get root node");
+                return NULL;
+            }
+        }while(token != AXIOM_XML_READER_START_ELEMENT);
     }
 
     return document->root_element;
@@ -111,12 +115,11 @@ axiom_document_build_all(
 {
     do
     {
-        axiom_node_t *ret_val = NULL;
-        ret_val = axiom_stax_builder_next(document->builder, env);
-        if(!ret_val && !axiom_node_is_complete(document->root_element, env))
+        int token = axiom_stax_builder_next_with_token(document->builder, env);
+        if((token == -1) && (!axiom_node_is_complete(document->root_element, env)))
         {
-            /* if return value is null and root node is not fully completed, this means there
is
-             * an error occurred */
+            /* if returned token is "invalid token" and root node is not fully completed,
+             * this means there is an error occurred */
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                 "Error occurred when building all nodes of document");
             return NULL;

Modified: axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c?rev=926525&r1=926524&r2=926525&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c (original)
+++ axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c Tue Mar 23 10:51:35 2010
@@ -685,91 +685,6 @@ axiom_stax_builder_end_element(
     return AXIS2_SUCCESS;
 }
 
-axiom_node_t *AXIS2_CALL
-axiom_stax_builder_next(
-    axiom_stax_builder_t * om_builder,
-    const axutil_env_t * env)
-{
-    int token = 0;
-    axiom_node_t *node = NULL;
-
-    do
-    {
-        if(om_builder->done)
-        {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_BUILDER_DONE_CANNOT_PULL, AXIS2_FAILURE);
-            return NULL;
-        }
-
-        token = axiom_xml_reader_next(om_builder->parser, env);
-        if(token == -1)
-        {
-            return NULL;
-        }
-
-        om_builder->current_event = token;
-
-        switch(token)
-        {
-            case AXIOM_XML_READER_START_DOCUMENT:
-                /*Do nothing */
-                break;
-
-            case AXIOM_XML_READER_START_ELEMENT:
-                node = axiom_stax_builder_create_om_element(om_builder, env, AXIS2_FALSE);
-                break;
-
-            case AXIOM_XML_READER_EMPTY_ELEMENT:
-
-#ifdef AXIS2_LIBXML2_ENABLED
-                node = axiom_stax_builder_create_om_element(om_builder, env, AXIS2_FALSE);
-#else
-                node = axiom_stax_builder_create_om_element(om_builder, env, AXIS2_TRUE);
-#endif
-
-            case AXIOM_XML_READER_END_ELEMENT:
-                axiom_stax_builder_end_element(om_builder, env);
-                break;
-
-            case AXIOM_XML_READER_SPACE:
-                node = axiom_stax_builder_create_om_text(om_builder, env);
-                break;
-
-            case AXIOM_XML_READER_CHARACTER:
-                node = axiom_stax_builder_create_om_text(om_builder, env);
-                break;
-
-            case AXIOM_XML_READER_ENTITY_REFERENCE:
-                break;
-
-            case AXIOM_XML_READER_COMMENT:
-
-                node = axiom_stax_builder_create_om_comment(om_builder, env);
-                axiom_stax_builder_end_element(om_builder, env);
-                break;
-
-            case AXIOM_XML_READER_PROCESSING_INSTRUCTION:
-
-                node = axiom_stax_builder_create_om_processing_instruction(om_builder, env);
-                axiom_stax_builder_end_element(om_builder, env);
-                break;
-
-            case AXIOM_XML_READER_CDATA:
-                break;
-
-            case AXIOM_XML_READER_DOCUMENT_TYPE:
-                break;
-
-            default:
-                break;
-        }
-    }
-    while(!node && !axiom_node_is_complete(om_builder->root_node, env));
-    return node;
-}
-
-
-
 /**
   * moves the reader to next event and returns the token returned by the xml_reader ,
   * @param builder pointer to STAX builder struct to be used
@@ -1055,4 +970,87 @@ axiom_stax_builder_set_cache(
 {
     om_builder->cache = enable_cache;
 }
+
+axiom_node_t *AXIS2_CALL
+axiom_stax_builder_next(
+    axiom_stax_builder_t * om_builder,
+    const axutil_env_t * env)
+{
+    int token = 0;
+    axiom_node_t *node = NULL;
+
+    do
+    {
+        if(om_builder->done)
+        {
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_BUILDER_DONE_CANNOT_PULL, AXIS2_FAILURE);
+            return NULL;
+        }
+
+        token = axiom_xml_reader_next(om_builder->parser, env);
+        if(token == -1)
+        {
+            return NULL;
+        }
+
+        om_builder->current_event = token;
+
+        switch(token)
+        {
+            case AXIOM_XML_READER_START_DOCUMENT:
+                /*Do nothing */
+                break;
+
+            case AXIOM_XML_READER_START_ELEMENT:
+                node = axiom_stax_builder_create_om_element(om_builder, env, AXIS2_FALSE);
+                break;
+
+            case AXIOM_XML_READER_EMPTY_ELEMENT:
+
+#ifdef AXIS2_LIBXML2_ENABLED
+                node = axiom_stax_builder_create_om_element(om_builder, env, AXIS2_FALSE);
+#else
+                node = axiom_stax_builder_create_om_element(om_builder, env, AXIS2_TRUE);
+#endif
+
+            case AXIOM_XML_READER_END_ELEMENT:
+                axiom_stax_builder_end_element(om_builder, env);
+                break;
+
+            case AXIOM_XML_READER_SPACE:
+                node = axiom_stax_builder_create_om_text(om_builder, env);
+                break;
+
+            case AXIOM_XML_READER_CHARACTER:
+                node = axiom_stax_builder_create_om_text(om_builder, env);
+                break;
+
+            case AXIOM_XML_READER_ENTITY_REFERENCE:
+                break;
+
+            case AXIOM_XML_READER_COMMENT:
+
+                node = axiom_stax_builder_create_om_comment(om_builder, env);
+                axiom_stax_builder_end_element(om_builder, env);
+                break;
+
+            case AXIOM_XML_READER_PROCESSING_INSTRUCTION:
+
+                node = axiom_stax_builder_create_om_processing_instruction(om_builder, env);
+                axiom_stax_builder_end_element(om_builder, env);
+                break;
+
+            case AXIOM_XML_READER_CDATA:
+                break;
+
+            case AXIOM_XML_READER_DOCUMENT_TYPE:
+                break;
+
+            default:
+                break;
+        }
+    }
+    while(!node && !axiom_node_is_complete(om_builder->root_node, env));
+    return node;
+}
 #endif

Modified: axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c?rev=926525&r1=926524&r2=926525&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c (original)
+++ axis/axis2/c/core/trunk/axiom/src/soap/soap_builder.c Tue Mar 23 10:51:35 2010
@@ -283,7 +283,8 @@ axiom_soap_builder_get_soap_envelope(
     return soap_builder->soap_envelope;
 }
 
-AXIS2_EXTERN axiom_document_t *AXIS2_CALL axiom_soap_builder_get_document(
+AXIS2_EXTERN axiom_document_t *AXIS2_CALL
+axiom_soap_builder_get_document(
     axiom_soap_builder_t * soap_builder,
     const axutil_env_t * env)
 {



Mime
View raw message