From 4c810e8d4b0af23ba44fabeea2eaeab8f78aea0e Mon Sep 17 00:00:00 2001 From: shankar Date: Tue, 6 Apr 2010 10:43:11 +0000 Subject: Adding axiom_document_build_next method git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@931079 13f79535-47bb-0310-9956-ffa450edef68 --- axiom/include/axiom_document.h | 10 ++++++++++ axiom/src/om/axiom_document_internal.h | 12 ++---------- axiom/src/om/om_document.c | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) (limited to 'axiom') diff --git a/axiom/include/axiom_document.h b/axiom/include/axiom_document.h index 87920c1..6b846ac 100644 --- a/axiom/include/axiom_document.h +++ b/axiom/include/axiom_document.h @@ -70,6 +70,16 @@ extern "C" axiom_document_t *document, const axutil_env_t * env); + /** Builds the next node if the builder is not finished with input xml stream + * @param document document whose next node is to be built. cannot be NULL + * @param env Environment. MUST NOT be NULL. + * @return pointer to the next node. NULL on error. + */ + AXIS2_EXTERN axiom_node_t *AXIS2_CALL + axiom_document_build_next( + struct axiom_document *document, + const axutil_env_t * env); + /** @} */ #ifdef __cplusplus diff --git a/axiom/src/om/axiom_document_internal.h b/axiom/src/om/axiom_document_internal.h index b71d1a7..daf28c8 100644 --- a/axiom/src/om/axiom_document_internal.h +++ b/axiom/src/om/axiom_document_internal.h @@ -60,16 +60,6 @@ extern "C" struct axiom_document *document, const axutil_env_t * env); - /** Builds the next node if the builder is not finished with input xml stream - * @param document document whose next node is to be built. cannot be NULL - * @param env Environment. MUST NOT be NULL. - * @return pointer to the next node. NULL on error. - */ - axiom_node_t *AXIS2_CALL - axiom_document_build_next( - struct axiom_document *document, - const axutil_env_t * env); - /** * set the root element of the document. IF a root node is already exist,it is freed * before setting to root element @@ -119,6 +109,8 @@ extern "C" struct axiom_document *document, const axutil_env_t * env, axiom_output_t * om_output); + + #endif #ifdef __cplusplus diff --git a/axiom/src/om/om_document.c b/axiom/src/om/om_document.c index aed3749..0d4d276 100644 --- a/axiom/src/om/om_document.c +++ b/axiom/src/om/om_document.c @@ -130,6 +130,33 @@ axiom_document_build_all( return document->root_element; } +AXIS2_EXTERN axiom_node_t *AXIS2_CALL +axiom_document_build_next( + axiom_document_t * document, + const axutil_env_t * env) +{ + axiom_node_t *return_node = NULL; + axiom_node_t *last_node = axiom_stax_builder_get_lastnode(document->builder, env); + while(document->root_element && !axiom_node_is_complete(document->root_element, env)) + { + int token = axiom_stax_builder_next_with_token(document->builder, env); + if(token == -1) + { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed to create next node"); + return_node = NULL; + break; + } + return_node = axiom_stax_builder_get_lastnode(document->builder, env); + if(last_node != return_node) + { + /* this is a new node created */ + break; + } + } + + return return_node; +} + #if 0 AXIS2_EXTERN axiom_stax_builder_t *AXIS2_CALL axiom_document_get_builder( -- cgit v1.1-32-gdbae