You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/10/06 14:47:20 UTC
svn commit: r306614 -
/webservices/axis2/trunk/c/modules/test/om/src/test_om_build.c
Author: samisa
Date: Thu Oct 6 05:44:41 2005
New Revision: 306614
URL: http://svn.apache.org/viewcvs?rev=306614&view=rev
Log: (empty)
Added:
webservices/axis2/trunk/c/modules/test/om/src/test_om_build.c
Added: webservices/axis2/trunk/c/modules/test/om/src/test_om_build.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/om/src/test_om_build.c?rev=306614&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/om/src/test_om_build.c (added)
+++ webservices/axis2/trunk/c/modules/test/om/src/test_om_build.c Thu Oct 6 05:44:41 2005
@@ -0,0 +1,63 @@
+#include <axis2_stax_ombuilder.h>
+#include <axis2_om_document.h>
+#include <axis2_om_node.h>
+#include <axis2_om_element.h>
+#include <axis2_om_text.h>
+#include <apr.h>
+
+int main()
+{
+ 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;
+ axis2_om_document_t *document = NULL;
+ axis2_om_node_t *node1 = NULL ,*node2 = NULL ,*node3 = NULL ;
+ FILE *fp = NULL;
+
+ fp = fopen ("test.xml", "r");
+
+ red = Reader_createReader (fp);
+
+ parser = XML_PullParser_createPullParser (red);
+
+ XML_PullParser_read (parser);
+
+
+ if(apr_initialize() != APR_SUCCESS)
+ {
+ return;
+ }
+ if(!fp)
+ {
+ printf("Read Failed");
+ }
+
+ builder = axis2_stax_om_builder_create(parser);
+ document = axis2_om_document_create(NULL,builder);
+ node1 = axis2_om_document_get_root_element(document);
+ printf(((axis2_om_element_t*)(node1->data_element))->localname);
+ printf("\n");
+ printf(((axis2_om_element_t*)(node1->data_element))->ns->prefix);
+ printf("\n");
+ printf(((axis2_om_element_t*)(node1->data_element))->ns->uri);
+ printf("\n");
+ node2 = axis2_om_document_get_first_child(document);
+ printf("\n");
+ printf(((axis2_om_element_t*)(node2->data_element))->localname);
+
+ node3 = axis2_om_document_get_first_child(document);
+ printf("\n");
+ printf(((axis2_om_text_t*)(node3->data_element))->value);
+
+getchar();
+
+}
+/*
+<?xml version="1.0" ?>
+<builder xmlns="http://www.wso2.com/" test="xml"><document>TEST</document><a></a><b></b></builder>
+
+*/
+
+
+