Index: configure =================================================================== --- configure (revision 332212) +++ configure (working copy) @@ -21953,7 +21953,7 @@ -CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g" +CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g3 -O2" #CFLAGS="$CFLAGS -Wall -ansi -Wshadow -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread" LDFLAGS="$LDFLAGS -L${CUTEST_HOME}/lib/" LIBS="-lcutest -ldl" Index: include/axis2_om_processing_instruction.h =================================================================== --- include/axis2_om_processing_instruction.h (revision 332212) +++ include/axis2_om_processing_instruction.h (working copy) @@ -123,3 +123,6 @@ #endif #endif /* AXIS2_OM_PI_H */ + + + Index: include/axis2_om_stax_builder.h =================================================================== --- include/axis2_om_stax_builder.h (revision 332212) +++ include/axis2_om_stax_builder.h (working copy) @@ -144,4 +144,4 @@ #endif -#endif /* AXIS2_OM_STAX_BUILDER_H */ \ No newline at end of file +#endif /* AXIS2_OM_STAX_BUILDER_H */ Index: include/axis2_om_node.h =================================================================== --- include/axis2_om_node.h (revision 332212) +++ include/axis2_om_node.h (working copy) @@ -138,28 +138,8 @@ axis2_env_t **env, struct axis2_om_node *parent_node); - /** - * gets the first child of a given node - * @param env Environment. MUST NOT be NULL, if NULL behaviour is undefined. - * @param parent_node node whose first child is to be returnd. - * @return a pointer to first child if there is one, else returns NULL. - * On error sets the error and returns NULL - */ - struct axis2_om_node *(AXIS2_CALL *iterator_get_first_child)(struct axis2_om_node *om_node, - axis2_env_t **env); - + /** - * Gets the next child of the given node. - * This function should only be called after a call to get_first_child function - * @param env Environment. MUST NOT be NULL, if NULL behaviour is undefined. - * @param parent_node node whose next child is to be returned. - * @return a pointer to next child if there is one, else returns NULL. - * On error sets the error and returns NULL - */ - struct axis2_om_node* (AXIS2_CALL *iterator_get_next_child) (struct axis2_om_node *om_node, - axis2_env_t **env); - - /** * Serializes the given node. This operation makes the node go through its children and * serialize them in order. * @param env Environment .MUST NOT be NULL, if NULL behaviour is undefined. @@ -269,15 +249,7 @@ /** sets the parent of the given node */ #define AXIS2_OM_NODE_SET_PARENT(om_node,env,parent_node) \ ((om_node)->ops->set_parent(om_node,env,parent_node)) - -/** gets the first child of the given node */ -#define AXIS2_OM_NODE_ITERATOR_GET_FIRST_CHILD(om_node,env) \ - ((om_node)->ops->iterator_get_first_child(om_node,env)) -/** gets the next child of the given node */ -#define AXIS2_OM_NODE_ITERATOR_GET_NEXT_CHILD(om_node,env) \ - ((om_node)->ops->iterator_get_next_child(om_node,env)) -/** serializes the given node */ #define AXIS2_OM_NODE_SERIALIZE(om_node,env, om_output) \ ((om_node)->ops->serialize(om_node,env,om_output)) Index: include/axis2_om_element.h =================================================================== --- include/axis2_om_element.h (revision 332212) +++ include/axis2_om_element.h (working copy) @@ -275,3 +275,6 @@ #endif #endif /* AXIS2_OM_ELEMENT_H */ + + + Index: include/axis2_om_namespace.h =================================================================== --- include/axis2_om_namespace.h (revision 332212) +++ include/axis2_om_namespace.h (working copy) @@ -150,3 +150,5 @@ #endif #endif /* AXIS2_OM_NAMESPACE */ + + Index: include/axis2_om_output.h =================================================================== --- include/axis2_om_output.h (revision 332212) +++ include/axis2_om_output.h (working copy) @@ -95,3 +95,5 @@ #endif #endif /* AXIS2_OM_OUTPUT_H */ + + Index: include/axis2_om_attribute.h =================================================================== --- include/axis2_om_attribute.h (revision 332212) +++ include/axis2_om_attribute.h (working copy) @@ -159,14 +159,14 @@ #define AXIS2_OM_ATTRIBUTE_GET_VALUE(om_attribute, env) \ ((om_attribute)->ops->get_value(om_attribute, env)) -#define AXIS2_OM_ATTRIBUTE_SET_NAMESPACE(om_attribute, env) \ - ((om_attribute)->ops->set_namespace(om_attribute, env)) +#define AXIS2_OM_ATTRIBUTE_SET_NAMESPACE(om_attribute, env,ns) \ + ((om_attribute)->ops->set_namespace(om_attribute, env,ns)) -#define AXIS2_OM_ATTRIBUTE_SET_LOCALNAME(om_attribute, env) \ - ((om_attribute)->ops->set_localname(om_attribute, env)) +#define AXIS2_OM_ATTRIBUTE_SET_LOCALNAME(om_attribute, env,localname) \ + ((om_attribute)->ops->set_localname(om_attribute, env,localname)) -#define AXIS2_OM_ATTRIBUTE_SET_VALUE(om_attribute, env) \ - ((om_attribute)->ops->set_value(om_attribute, env)) +#define AXIS2_OM_ATTRIBUTE_SET_VALUE(om_attribute, env,value) \ + ((om_attribute)->ops->set_value(om_attribute, env,value)) Index: include/axis2_om_doctype.h =================================================================== --- include/axis2_om_doctype.h (revision 332212) +++ include/axis2_om_doctype.h (working copy) @@ -107,3 +107,5 @@ #endif #endif /* AXIS2_OM_DOCTYPE_H */ + + Index: include/axis2_om_text.h =================================================================== --- include/axis2_om_text.h (revision 332212) +++ include/axis2_om_text.h (working copy) @@ -118,7 +118,7 @@ #define AXIS2_OM_TEXT_SET_VALUE(om_text, env, value) \ ((om_text)->ops->set_value(om_text, env, value)) - + /** @} */ Index: configure.ac =================================================================== --- configure.ac (revision 332212) +++ configure.ac (working copy) @@ -25,7 +25,7 @@ #using libtool AM_PROG_LIBTOOL -CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g" +CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g3 -O2" #CFLAGS="$CFLAGS -Wall -ansi -Wshadow -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread" LDFLAGS="$LDFLAGS -L${CUTEST_HOME}/lib/" LIBS="-lcutest -ldl" Index: modules/test/om/src/test_om.c =================================================================== --- modules/test/om/src/test_om.c (revision 332224) +++ modules/test/om/src/test_om.c (working copy) @@ -100,9 +100,6 @@ AXIS2_OM_NODE_SERIALIZE (node1, &environment , om_output); AXIS2_FREE (environment->allocator, om_output); - /* AXIS2_OM_NODE_FREE(node1,&environment); */ - - AXIS2_OM_STAX_BUILDER_FREE ( builder, &environment); guththila_xml_pull_parser_free (my_guththila_environment, parser); printf ("\n\n"); Index: modules/xml/om/src/axis2_om_node.c =================================================================== --- modules/xml/om/src/axis2_om_node.c (revision 332224) +++ modules/xml/om/src/axis2_om_node.c (working copy) @@ -148,8 +148,6 @@ struct axis2_om_node *next_sibling; /** first child */ struct axis2_om_node *first_child; - /** current child */ - struct axis2_om_node *current_child; /** last child */ struct axis2_om_node *last_child; /** node type, indicates the type stored in data_element */ @@ -196,13 +194,12 @@ node->om_node.ops->add_child = axis2_om_node_add_child; node->om_node.ops->free = axis2_om_node_free; node->om_node.ops->detach = axis2_om_node_detach; - node->om_node.ops->iterator_get_first_child = axis2_om_node_get_first_child; + node->om_node.ops->insert_sibling_after = axis2_om_node_insert_sibling_after; node->om_node.ops->insert_sibling_before = axis2_om_node_insert_sibling_before; 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; @@ -231,8 +228,8 @@ node->node_type = AXIS2_OM_INVALID; node->done = AXIS2_FALSE; node->data_element = NULL; - node->current_child = NULL; + return &(node->om_node); } @@ -472,71 +469,17 @@ return AXIS2_SUCCESS; } - -axis2_om_node_t* AXIS2_CALL -axis2_om_node_iterator_get_first_child (axis2_om_node_t *om_node, - axis2_env_t **env) -{ - AXIS2_ENV_CHECK(env, NULL); - AXIS2_FUNC_PARAM_CHECK( om_node, env, NULL); - - if(AXIS2_INTF_TO_IMPL(om_node)->first_child) - { - - AXIS2_INTF_TO_IMPL(om_node)->current_child = - AXIS2_INTF_TO_IMPL(om_node)->first_child; - return AXIS2_INTF_TO_IMPL(om_node)->first_child; - - } - return NULL; -} - -axis2_om_node_t* AXIS2_CALL -axis2_om_node_iterator_get_next_child (axis2_om_node_t *om_node, - axis2_env_t **env) -{ - axis2_om_node_t *node = NULL; - axis2_om_node_t *current_child = NULL; - AXIS2_ENV_CHECK(env, NULL); - AXIS2_FUNC_PARAM_CHECK(om_node, env, NULL); - AXIS2_FUNC_PARAM_CHECK(AXIS2_INTF_TO_IMPL(om_node)->first_child, env, NULL); - if(!(AXIS2_INTF_TO_IMPL(om_node)->current_child)) - { - (*env)->error->error_number = AXIS2_ERROR_INVALID_ITERATOR_STATE; - - return NULL; - - } - current_child = AXIS2_INTF_TO_IMPL(om_node)->current_child; - - if(current_child && AXIS2_INTF_TO_IMPL(current_child)->next_sibling) - { - node = AXIS2_INTF_TO_IMPL(current_child)->next_sibling; - AXIS2_INTF_TO_IMPL(om_node)->current_child = node; - return node; - } - return NULL; -} - axis2_status_t AXIS2_CALL axis2_om_node_serialize (axis2_om_node_t *om_node, axis2_env_t **env, axis2_om_output_t *om_output) { - axis2_om_node_t *child_node = NULL; int status = AXIS2_SUCCESS; AXIS2_FUNC_PARAM_CHECK(om_node, env, AXIS2_FAILURE); + AXIS2_PARAM_CHECK((*env)->error,om_output,AXIS2_FAILURE); - if(!om_output) - { - AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error , - AXIS2_ERROR_INVALID_NULL_PARAM); - AXIS2_ERROR_SET_STATUS_CODE((*env)->error , AXIS2_FAILURE); - return AXIS2_FAILURE; - } - switch (AXIS2_INTF_TO_IMPL(om_node)->node_type) { case AXIS2_OM_ELEMENT: @@ -559,18 +502,11 @@ default: break; } + + /* serialize children of this node */ + if(AXIS2_INTF_TO_IMPL(om_node)->first_child) + status = axis2_om_node_serialize(AXIS2_INTF_TO_IMPL(om_node)->first_child, env, om_output); - - child_node = axis2_om_node_iterator_get_first_child ( om_node , env); - - while (child_node) - { - status = axis2_om_node_serialize (child_node, env, om_output); - if (status != AXIS2_SUCCESS) - return status; - child_node = axis2_om_node_iterator_get_next_child (om_node, env); - } - switch (AXIS2_INTF_TO_IMPL(om_node)->node_type) { case AXIS2_OM_ELEMENT: @@ -584,10 +520,11 @@ default: break; } - + /* serialize next sibling */ + if(AXIS2_INTF_TO_IMPL(om_node)->next_sibling) + status = axis2_om_node_serialize(AXIS2_INTF_TO_IMPL(om_node)->next_sibling, env, om_output); + return status; - - return AXIS2_SUCCESS; }