Author: nandika
Date: Wed May 3 21:31:12 2006
New Revision: 399541
URL: http://svn.apache.org/viewcvs?rev=399541&view=rev
Log:
AXIS2_OM_NODE_TO_STRING function added
Modified:
webservices/axis2/trunk/c/include/axis2_om_node.h
webservices/axis2/trunk/c/modules/xml/om/om_node.c
Modified: webservices/axis2/trunk/c/include/axis2_om_node.h
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_node.h?rev=399541&r1=399540&r2=399541&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_node.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_node.h Wed May 3 21:31:12 2006
@@ -242,6 +242,10 @@
struct axis2_om_document* (AXIS2_CALL *
get_document)(axis2_om_node_t *om_node,
axis2_env_t **env);
+
+ axis2_char_t* (AXIS2_CALL *
+ to_string)(axis2_om_node_t *om_node,
+ axis2_env_t **env);
} axis2_om_node_ops_t;
@@ -311,7 +315,9 @@
/** get document */
#define AXIS2_OM_NODE_GET_DOCUMENT(om_node, env) \
((om_node)->ops->get_document(om_node, env))
-
+
+#define AXIS2_OM_NODE_TO_STRING(om_node, env) \
+ ((om_node)->ops->to_string(om_node, env))
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/modules/xml/om/om_node.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_node.c?rev=399541&r1=399540&r2=399541&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_node.c Wed May 3 21:31:12 2006
@@ -55,6 +55,10 @@
axis2_om_node_serialize (axis2_om_node_t * om_node,
axis2_env_t **env,
axis2_om_output_t * om_output);
+
+axis2_char_t * AXIS2_CALL
+axis2_om_node_to_string(axis2_om_node_t *om_node,
+ axis2_env_t **env);
/****************************** accessor mutator
*********************************************/
@@ -170,7 +174,7 @@
node->om_node.ops->add_child = axis2_om_node_add_child;
node->om_node.ops->free = axis2_om_node_free_tree;
node->om_node.ops->detach = axis2_om_node_detach;
-
+ node->om_node.ops->to_string = axis2_om_node_to_string;
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->serialize = axis2_om_node_serialize;
@@ -821,3 +825,34 @@
return NULL;
return AXIS2_INTF_TO_IMPL(om_node)->builder;
}
+
+axis2_char_t * AXIS2_CALL
+axis2_om_node_to_string(axis2_om_node_t *om_node,
+ axis2_env_t **env)
+{
+
+ int status = AXIS2_SUCCESS;
+ axis2_om_output_t *om_output = NULL;
+ axis2_xml_writer_t *xml_writer = NULL;
+ axis2_char_t *xml = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, om_node, NULL);
+
+ xml_writer = axis2_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0);
+ if(!xml_writer)
+ return NULL;
+
+ om_output = axis2_om_output_create(env, xml_writer);
+ if(!om_output)
+ {
+ AXIS2_XML_WRITER_FREE(xml_writer, env);
+ return NULL;
+ }
+ status = AXIS2_OM_NODE_SERIALIZE(om_node, env, om_output);
+ if(status == AXIS2_SUCCESS)
+ {
+ xml = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
+ }
+ AXIS2_OM_OUTPUT_FREE(om_output, env);
+ return xml;
+}
\ No newline at end of file