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/10/18 11:32:01 UTC
svn commit: r326061 - in /webservices/axis2/trunk/c: include/
modules/test/om/src/ modules/xml/om/src/
Author: samisa
Date: Tue Oct 18 02:31:45 2005
New Revision: 326061
URL: http://svn.apache.org/viewcvs?rev=326061&view=rev
Log:
Changes to get the serialization working
Modified:
webservices/axis2/trunk/c/include/axis2_om_node.h
webservices/axis2/trunk/c/include/axis2_qname.h
webservices/axis2/trunk/c/modules/test/om/src/Makefile.am
webservices/axis2/trunk/c/modules/test/om/src/Makefile.in
webservices/axis2/trunk/c/modules/test/om/src/test_om.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.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=326061&r1=326060&r2=326061&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_node.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_node.h Tue Oct 18 02:31:45 2005
@@ -178,10 +178,10 @@
((current_node)->ops->axis2_om_node_ops_insert_sibling_after(environment,current_node,node_to_insert))
#define axis2_om_node_insert_sibling_before(environment,current_node,node_to_insert) ((current_node)->ops->axis2_om_node_ops_insert_sibling_before(environment,current_node,node_to_insert))
-#define axis2_om_node_set_parent(environment,child_node,parent_node) ((child_node)->ops->axis2_om_node_ops_set_parent(environment,child_node,parent_node))
-#define axis2_om_node_get_first_child(environment,om_node) ((om_node)->ops->axis2_om_node_get_ops_first_child(environment,om_node))
-#define axis2_om_node_get_next_child(environment,om_node) ((om_node)->ops->axis2_om_node_get_ops_next_child(environemt,om_node))
-#define axis2_om_node_serialize(environment,om_node,om_output) ((om_node)->ops->axis2_om_node_ops_serialize(environment,om_node,om_output))
+#define axis2_om_node_set_parent(environment,child_node,parent_node) ((child_node)->ops->axis2_om_node_ops_set_parent(environment, child_node,parent_node))
+#define axis2_om_node_get_first_child(environment, om_node) ((om_node)->ops->axis2_om_node_ops_get_first_child(environment, om_node))
+#define axis2_om_node_get_next_child(environment, om_node) ((om_node)->ops->axis2_om_node_ops_get_next_child(environment, om_node))
+#define axis2_om_node_serialize(environment, om_node, om_output) ((om_node)->ops->axis2_om_node_ops_serialize(environment, om_node, om_output))
Modified: webservices/axis2/trunk/c/include/axis2_qname.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_qname.h?rev=326061&r1=326060&r2=326061&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_qname.h (original)
+++ webservices/axis2/trunk/c/include/axis2_qname.h Tue Oct 18 02:31:45 2005
@@ -26,7 +26,7 @@
#include <axis2_environment.h>
-const axis2_char_t XML_NAMESPACE_URI[] ="http://www.w3c.org/XML/1998/namespace";
+static const axis2_char_t XML_NAMESPACE_URI[] ="http://www.w3c.org/XML/1998/namespace";
struct axis2_qname;
struct axis2_qname_ops;
Modified: webservices/axis2/trunk/c/modules/test/om/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/om/src/Makefile.am?rev=326061&r1=326060&r2=326061&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/om/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/test/om/src/Makefile.am Tue Oct 18 02:31:45 2005
@@ -1,11 +1,11 @@
prgbindir=$(prefix)/bin/system_test
prgbin_PROGRAMS = test_om
SUBDIRS =
-AM_CPPFLAGS = $(CPPFLAGS)
+AM_CPPFLAGS = $(CPPFLAGS) -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread
test_om_SOURCES = test_om.c
test_om_LDADD = $(LDFLAGS) $(top_builddir)/modules/xml/om/src/libom.la \
$(top_builddir)/modules/xml/guththila/src/libguththila.la
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
- -I$(top_builddir)/modules/xml/guththila/src
+ -I$(top_builddir)/modules/xml/guththila/src -I${APR_HOME}/include/apr-1
Modified: webservices/axis2/trunk/c/modules/test/om/src/Makefile.in
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/om/src/Makefile.in?rev=326061&r1=326060&r2=326061&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/test/om/src/Makefile.in (original)
+++ webservices/axis2/trunk/c/modules/test/om/src/Makefile.in Tue Oct 18 02:31:45 2005
@@ -195,13 +195,13 @@
target_vendor = @target_vendor@
prgbindir = $(prefix)/bin/system_test
SUBDIRS =
-AM_CPPFLAGS = $(CPPFLAGS)
+AM_CPPFLAGS = $(CPPFLAGS) -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread
test_om_SOURCES = test_om.c
test_om_LDADD = $(LDFLAGS) $(top_builddir)/modules/xml/om/src/libom.la \
$(top_builddir)/modules/xml/guththila/src/libguththila.la
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
- -I$(top_builddir)/modules/xml/guththila/src
+ -I$(top_builddir)/modules/xml/guththila/src -I${APR_HOME}/include/apr-1
all: all-recursive
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=326061&r1=326060&r2=326061&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 Tue Oct 18 02:31:45 2005
@@ -1,13 +1,20 @@
-#include <axis2_stax_ombuilder.h>
+/*#include <axis2_om_stax_builder.h>*/
#include <axis2_om_document.h>
#include <axis2_om_node.h>
#include <axis2_om_element.h>
#include <axis2_om_text.h>
+
+#include <stdio.h>
#include <apr.h>
+#include <apr_general.h>
+
+axis2_allocator_t *allocator = NULL;
+axis2_string_t *string = NULL;
+axis2_environment_t *environment = NULL;
int test_om_build()
{
- READER *red = NULL;
+ /*READER *red = NULL;
XML_PullParser *parser = NULL;
axis2_om_element_t *ele1=NULL,*ele2=NULL,*ele3 = NULL,*ele4 = NULL;
axis2_stax_om_builder_t *builder = NULL;
@@ -50,7 +57,7 @@
printf("\n");
printf(((axis2_om_text_t*)(node3->data_element))->value);
-getchar();
+*/
}
/*
@@ -62,8 +69,6 @@
int test_om_serialize ()
{
printf("START\n");
- if ( apr_initialize () != APR_SUCCESS )
- return -1;
/*
<book xmlns:axiomc="http://ws.apache.org/axis2/c/om" xmlns:isbn="urn:ISBN:0-395-74341-6">
<title>Axis2/C OM HOWTO</title>
@@ -84,45 +89,47 @@
axis2_om_text_t *text1 = NULL, *text2 = NULL, *text3 = NULL;
axis2_om_output_t* om_output = NULL;
- ns1 = axis2_om_namespace_create ("http://ws.apache.org/axis2/c/om", "axiom");
- ns2 = axis2_om_namespace_create ("urn:ISBN:0-395-74341-6", "isbn");
- ns3 = axis2_om_namespace_create ("urn:w3-org-ns:HTML", "NULL");
+ ns1 = 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", "isbn");
+ ns3 = axis2_om_namespace_create (environment, "urn:w3-org-ns:HTML", "NULL");
- ele1 = axis2_om_element_create (NULL, "book", ns1, &node1);
- axis2_om_element_declare_namespace(node1, ns2);
+ ele1 = axis2_om_element_create (environment, NULL, "book", ns1, &node1);
+ /*axis2_om_element_declare_namespace(environment, node1, ns2); */
- ele2 = axis2_om_element_create (node1, "title", ns1, &node2);
- text1 = axis2_om_text_create (node2, "Axis2/C OM HOWTO", &node3);
+ 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 (node1, "number", ns2, &node4);
- text1 = axis2_om_text_create (node4, "1748491379", &node5);
+ ele3 = axis2_om_element_create (environment, node1, "number", ns2, &node4);
+ text1 = axis2_om_text_create (environment, node4, "1748491379", &node5);
- ele4 = axis2_om_element_create (node1, "author", ns1, &node6);
- attr1 = axis2_om_attribute_create ("title", "Mr", ns1);
- axis2_om_element_add_attribute (node6, attr1);
- attr2 = axis2_om_attribute_create ("name", "Axitoc Oman", ns1);
- axis2_om_element_add_attribute (node6, attr2);
+ 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 (NULL, "notes", ns1, &node2);
- ele3 = axis2_om_element_create (node2, "p", ns3, &node3);
- text1 = axis2_om_text_create (node3, "This is <i>vey good</i> book on OM!", &node4);
+ 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 (node1, node2);
+ /*ele3 = axis2_om_element_create (NULL, "ele3", ns3 , &node3);*/
+ axis2_om_node_add_child (environment, node1, node2);
- // serializing stuff
- om_output = axis2_create_om_output(stderr);
- //axis2_om_element_serialize_start_part(ele3, om_output);
- //axis2_om_element_serialize_end_part(ele3, om_output);
+ /* serializing stuff */
+ om_output = axis2_create_om_output(environment, NULL);
+ /*axis2_om_element_serialize_start_part(ele3, om_output);
+ axis2_om_element_serialize_end_part(ele3, om_output);*/
- int status = axis2_om_node_serialize(node1, om_output);
+ int status = axis2_om_node_serialize(environment, node1, om_output);
if (status != AXIS2_SUCCESS)
{
printf("\naxis2_om_node_serialize failed\n");
return status;
}
- // end serializing stuff
+ else
+ printf("\naxis2_om_node_serialize success\n");
+ /* end serializing stuff*/
printf("\nDONE\n");
@@ -131,6 +138,10 @@
int main(void)
{
+ allocator = axis2_allocator_init (NULL);
+ environment = axis2_environment_create (allocator, NULL, NULL, NULL, NULL);
+ if ( apr_initialize () != APR_SUCCESS )
+ return -1;
test_om_build();
test_om_serialize();
}
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=326061&r1=326060&r2=326061&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 Tue Oct 18 02:31:45 2005
@@ -188,7 +188,9 @@
}
}
}
- ns = axis2_hash_get (element->namespaces, prefix, AXIS2_HASH_KEY_STRING);
+
+ if (element->namespaces)
+ ns = axis2_hash_get (element->namespaces, prefix, AXIS2_HASH_KEY_STRING);
if (ns)
{
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=326061&r1=326060&r2=326061&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 Tue Oct 18 02:31:45 2005
@@ -15,6 +15,8 @@
*/
#include <axis2_om_node.h>
+#include <axis2_om_element.h>
+#include <axis2_om_text.h>
axis2_status_t axis2_om_node_impl_free(axis2_environment_t *environment,axis2_om_node_t * node);
axis2_status_t axis2_om_node_impl_add_child(axis2_environment_t *environment,axis2_om_node_t * parent, axis2_om_node_t * child);
@@ -289,9 +291,9 @@
return NULL;
}
-axis2_status_t *axis2_om_node_impl_serialize(axis2_environment_t *environment,axis2_om_node_t *om_node, axis2_om_output_t * om_output)
+axis2_status_t *axis2_om_node_impl_serialize(axis2_environment_t *environment, axis2_om_node_t *om_node, axis2_om_output_t * om_output)
{
-/* axis2_om_node_t *child_node = NULL;
+ axis2_om_node_t *child_node = NULL;
int status = AXIS2_SUCCESS;
if (!om_node || !om_output)
@@ -302,12 +304,12 @@
switch (om_node->node_type)
{
case AXIS2_OM_ELEMENT:
- status = axis2_om_element_serialize_start_part( (axis2_om_element_t*)om_node->data_element, om_output );
+ status = axis2_om_element_serialize_start_part(environment, (axis2_om_element_t*)om_node->data_element, om_output );
if (status != AXIS2_SUCCESS)
return status;
break;
case AXIS2_OM_TEXT:
- status = axis2_om_text_serialize((axis2_om_text_t*)om_node->data_element, om_output );
+ status = axis2_om_text_serialize(environment, (axis2_om_text_t*)om_node->data_element, om_output );
return status;
break;
}
@@ -317,22 +319,22 @@
while (child_node)
{
- status = axis2_om_node_serialize(child_node, om_output);
+ status = axis2_om_node_serialize(environment, child_node, om_output);
if (status != AXIS2_SUCCESS)
return status;
- child_node = axis2_om_node_get_next_child(om_node);
+ child_node = axis2_om_node_get_next_child(environment, om_node);
}
- switch (om_node->element_type)
+ switch (om_node->node_type)
{
case AXIS2_OM_ELEMENT:
- status = axis2_om_element_serialize_end_part( (axis2_om_element_t*)om_node->data_element, om_output );
+ status = axis2_om_element_serialize_end_part(environment, (axis2_om_element_t*)om_node->data_element, om_output );
if (status != AXIS2_SUCCESS)
return status;
break;
}
return status;
-*/
+
return AXIS2_SUCCESS;
}
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=326061&r1=326060&r2=326061&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 Tue Oct 18 02:31:45 2005
@@ -123,7 +123,7 @@
}
if (om_text->value)
- status = axis2_om_output_write (om_output, AXIS2_OM_TEXT, 1,
+ status = axis2_om_output_write (environment, om_output, AXIS2_OM_TEXT, 1,
om_text->value);
return status;
}