axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r351636 [3/3] - in /webservices/axis2/trunk/c/modules/test: ./ xml/ xml/om/
Date Fri, 02 Dec 2005 08:27:19 GMT
Added: webservices/axis2/trunk/c/modules/test/xml/om/namespaces.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/namespaces.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/namespaces.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/namespaces.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<foo:a xmlns:foo="http://fooNamespace/">
+  <b>
+    <c>Hello</c>
+  </b>
+
+  <foo:d>
+    <foo:e>Hey</foo:e>
+  </foo:d>
+
+  <bar:f xmlns:bar="http://barNamespace/">
+    <bar:g>Hey2</bar:g>
+  </bar:f>
+
+  <alias:x xmlns:alias="http://fooNamespace/">
+    <alias:y>Hey3</alias:y>
+  </alias:x>
+</foo:a>

Added: webservices/axis2/trunk/c/modules/test/xml/om/nitf.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/nitf.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/nitf.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/nitf.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nitf>
+
+  <!-- Example of markup of URLs (at the bottom of the story) -->
+
+ <head>
+  <meta name="ap-cycle" content="AP"/>
+  <meta name="ap-online-code" content="1700"/>
+  <meta name="ap-company" content="CO:Media Metrix Inc;TS:MMXI;IG:SVC;"/>
+  <meta name="ap-routing" content="ENTITLEMENTS,pfONLINE,pf1700"/>
+  <meta name="ap-format" content="bx"/>
+  <meta name="ap-category" content="f"/>
+  <meta name="ap-selector" content="-----"/>
+  <meta name="ap-transref" content="V0347"/>
+  <docdata>
+   <doc-id regsrc="AP" id-string="D76UIMO80"/>
+   <urgency ed-urg="7"/>
+   <date.issue norm="20000911T185842Z"/>
+   <du-key key="Napster Traffic"/>
+   <doc.copyright holder="(AP)"/>
+  </docdata>
+ </head>
+ <body>
+  <body.head>
+   <hedline>
+    <hl1>Use of Napster Quadruples</hl1>
+   </hedline>
+   <byline>By PETER SVENSSON
+    <byttl>AP Business Writer</byttl>
+   </byline>
+   <distributor>The Associated Press</distributor>
+   <dateline>
+    <location>NEW YORK</location>
+   </dateline>
+  </body.head>
+  <body.content>
+   <block>
+    <p>Despite the uncertain legality of the Napster online music-sharing service,
the number of people
+using it more than quadrupled in just five months, Media Metrix said Monday.</p>
+    <p>That made Napster the fastest-growing software application ever recorded by
the Internet research
+company.</p>
+    <p>From 1.1 million home users in the United States in February, the first month
Media Metrix
+tracked the application, Napster use rocketed to 4.9 million users in July.</p>
+    <p>That represents 6 percent of U.S. home PC users who have modems, said Media
Metrix, which pays
+people to install monitoring software on their computers.</p>
+    <p>It estimates total usage from a panel of about 50,000 people in the United States.</p>
+    <p>Napster was also used at work by 887,000 people in July, Media Metrix said.</p>
+    <p>Napster Inc. has been sued by the recording industry for allegedly enabling
copyright
+infringement. The federal government weighed in on the case Friday, saying the service is
not protected
+under a key copyright law, as the San Mateo, Calif., company claims.</p>
+    <p>Bruce Ryon, head of Media Metrix&apos;s New Media Group, said Napster was
used by &quot;the full spectrum of PC users, not just the youth with time on their hands
and a passion for music.&quot;</p>
+    <p>The Napster program allows users to copy digital music files from the hard drives
of other
+users over the Internet.</p>
+    <p>Napster Inc. said last week that 28 million people had downloaded its program.
It does not reveal
+its own figures for how many people actually use the software.</p>
+    <p>Because the program connects to the company&apos;s computers over the Internet
every time
+it is run, Napster Inc. can track usage exactly.</p>
+    <p>__</p>
+    <p>On the Net:</p>
+    <p><a href="http://www.napster.com">
+http://www.napster.com</a></p>
+    <p><a href="http://www.mediametrix.com">
+http://www.mediametrix.com</a></p>
+   </block>
+  </body.content>
+ </body>
+</nitf>

Added: webservices/axis2/trunk/c/modules/test/xml/om/numbers.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/numbers.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/numbers.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/numbers.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+
+<numbers>
+  <set>
+    <nr>3</nr>
+    <nr>24</nr>
+    <nr>55</nr>
+    <nr>11</nr>
+    <nr>2</nr>
+    <nr>-3</nr>
+  </set>
+  <set>
+    <nr value="66"/>
+    <nr value="123"/>
+    <nr value="55"/>
+    <nr value="9999"/>
+  </set>
+</numbers>

Added: webservices/axis2/trunk/c/modules/test/xml/om/pi.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/pi.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/pi.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/pi.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<foo>
+	<?cheese is tasty?>
+	<bar>
+		<baz/>
+		<cheese/>
+		<baz/>
+		<?toast is tasty?>
+		<cheese/>
+		<baz/>
+	</bar>
+	<?cheese is gooey?>
+</foo>

Added: webservices/axis2/trunk/c/modules/test/xml/om/pi2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/pi2.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/pi2.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/pi2.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<a>
+  <b>foo</b>
+  <?toc order-by="x"?>
+  <c>bar</c>
+</a>

Added: webservices/axis2/trunk/c/modules/test/xml/om/simple.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/simple.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/simple.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/simple.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>
+<root><a>a</a><b>b</b><c><d>d</d></c></root>

Added: webservices/axis2/trunk/c/modules/test/xml/om/spaces.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/spaces.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/spaces.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/spaces.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<foo>
+    <bar>baz
+        <cheese id="3"/>
+        baz
+        <cheese/>
+        baz
+    </bar>
+    <doc><![CDATA[<foo>]]></doc>
+</foo>
\ No newline at end of file

Added: webservices/axis2/trunk/c/modules/test/xml/om/t.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/t.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/t.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/t.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,3 @@
+<? xml version="1.0" ?>
+<test>hello<foo/></test>
+

Added: webservices/axis2/trunk/c/modules/test/xml/om/test.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/test.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/test.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/test.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<book xmlns:axiomc="http://ws.apache.org/axis2/c/om" xmlns:isbn="urn:ISBN:0-395-74341-6">
+	<axiomc:title>Axis2C OM HOWTO</axiomc:title>
+	<isbn:number>1748491379</isbn:number>
+	<author title="Mr" name="Axitoc Oman"/>
+    <a>   </a>
+	<notes>
+		<p xmlns="urn:w3-org-ns:HTML">
+			This is vey good book on OM!
+		</p>
+	</notes>
+</book>

Added: webservices/axis2/trunk/c/modules/test/xml/om/testNamespaces.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/testNamespaces.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/testNamespaces.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/testNamespaces.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,22 @@
+<Template> 
+  <Application1 xmlns:xplt="http://www.xxxx.com/"
+                xmlns:xpl="http://www.xxxx.com/"
+                version="3.0"
+                randomAttribute="foo"
+  >
+    <xpl:insertText/> 
+    <xplt:anyElement> 
+      <Name/> 
+    </xplt:anyElement> 
+  </Application1> 
+
+  <Application2 xmlns:xplt="http://www.xxxx.com/"
+                xmlns:xpl="http://www.xxxx.com/"
+                version="3.0"
+  > 
+    <xpl:insertText/> 
+    <xplt:anyElement> 
+      <Name/> 
+    </xplt:anyElement> 
+  </Application2> 
+</Template>

Added: webservices/axis2/trunk/c/modules/test/xml/om/test_om.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/test_om.c?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/test_om.c (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/test_om.c Fri Dec  2 00:26:54 2005
@@ -0,0 +1,247 @@
+#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 <axis2_stream_default.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+
+#include <stdio.h>
+#include <axis2_xml_writer.h>
+
+/** 
+   Define the environment related variables globaly so that they are available 
+   for both functions 
+*/
+
+axis2_allocator_t *allocator = NULL;
+axis2_env_t *environment = NULL;
+axis2_stream_t *stream = NULL;
+axis2_error_t *error = NULL;
+axis2_log_t *axis_log     = NULL;
+FILE *f = NULL;
+/** a method that demonstrate creating a om model using an xml file */
+
+
+int read_input(char *buffer,int size)
+{
+   return fread(buffer, sizeof(char),size,f);
+}
+
+int
+test_om_build (char *filename)
+{
+    axis2_om_element_t *ele1 = NULL, *ele2 = NULL;
+    axis2_om_stax_builder_t *builder = NULL;
+    axis2_om_text_t *text = NULL;
+    axis2_om_document_t *document = NULL;
+    axis2_om_node_t *node1 = NULL, *node2 = NULL;
+    axis2_om_output_t *om_output = NULL;
+    axis2_om_namespace_t* ns = NULL;
+    axis2_pull_parser_t *pull_parser = NULL;
+    
+    f =fopen(filename, "r");
+    if(!f)
+        return -1;
+      
+    /** create pull parser */
+    pull_parser = axis2_pull_parser_create_for_memory(&environment, read_input, NULL);
+    
+    if(!pull_parser)
+    {
+        printf("ERROR CREATING PULLPARSER");
+        return -1;
+    }
+    /** create axis2_om_stax_builder by parsing pull_parser struct */
+    
+    builder = axis2_om_stax_builder_create (&environment,pull_parser);
+    
+    if(!builder)
+    {
+        printf("ERROR CREATING PULL PARSER");
+        return -1;
+    }
+    /** 
+        create an om document
+        document is the container of om model created using builder 
+    */
+           
+    document = axis2_om_document_create (&environment, NULL, builder);
+    /**
+        get root element , building starts hear 
+     */
+    
+    node1 = AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT (document,&environment);
+    if(node1)
+    {
+        /** print root node information */
+        
+       
+        ele1 =AXIS2_OM_NODE_GET_DATA_ELEMENT(node1,&environment);
+        if(ele1)
+             
+        printf ("root localname %s\n",AXIS2_OM_ELEMENT_GET_LOCALNAME(ele1,&environment));
+         
+        ns = AXIS2_OM_ELEMENT_GET_NAMESPACE(ele1,&environment);
+    
+        if (ns)
+        {
+            printf ("root ns prefix %s\n", AXIS2_OM_NAMESPACE_GET_PREFIX(ns,&environment));
+            printf ("root ns uri %s\n", AXIS2_OM_NAMESPACE_GET_PREFIX(ns,&environment));
+
+        }
+    }
+    /** build the document continuously untill all the xml file is built in to a om model
*/
+    
+    
+    node2 = AXIS2_OM_DOCUMENT_BUILD_NEXT( document , &environment);
+    do
+    {
+
+        if (!node2)
+            break;
+
+        switch (AXIS2_OM_NODE_GET_NODE_TYPE(node2,&environment))
+        {
+        case AXIS2_OM_ELEMENT:
+            ele2 =(axis2_om_element_t*) AXIS2_OM_NODE_GET_DATA_ELEMENT(node2, &environment);
+            if(ele2 && AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment))
+                printf("\n localname %s\n" , AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment));

+                        
+            break;
+        case AXIS2_OM_TEXT:
+            
+            text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node2,&environment);
   
+            if( text && AXIS2_OM_TEXT_GET_VALUE(text ,&environment))
+                printf("\n text value  %s \n", AXIS2_OM_TEXT_GET_VALUE(text,&environment));
+            break;
+
+        default:
+            break;
+        }
+
+        node2 = AXIS2_OM_DOCUMENT_BUILD_NEXT (document , &environment);
+    }
+    while (node2);
+    printf ("END: pull document\n");
+
+    printf ("Serialize pulled document\n");
+    
+    
+    om_output = axis2_om_output_create (&environment, NULL);
+    AXIS2_OM_NODE_SERIALIZE (AXIS2_OM_DOCUMENT_GET_ROOT_ELEMENT(document, &environment),
&environment , om_output);
+    AXIS2_OM_DOCUMENT_FREE(document, &environment); 
+    axis2_om_output_free(om_output, &environment);  
+    AXIS2_OM_STAX_BUILDER_FREE(builder, &environment);
+  
+    AXIS2_PULL_PARSER_FREE(pull_parser, &environment);    
+    
+
+    
+    printf ("\ndone\n");
+    return 0;
+}
+
+
+
+int
+test_om_serialize ()
+{
+
+    /*
+       <book xmlns:axiomc="http://ws.apache.org/axis2/c/om" xmlns:isbn="urn:ISBN:0-395-74341-6">
+       <title>Axis2/C OM HOWTO</title>
+       <isbn:number>1748491379</isbn:number>
+       <author title="Mr" name="Axitoc Oman" />
+       <notes>
+       <p xmlns="urn:w3-org-ns:HTML">
+       This is <i>vey good</i> book on OM!
+       </p>
+       </notes>
+       </book>
+    */
+    int status;
+    axis2_om_element_t *ele1 = NULL, *ele2 = NULL, *ele3 = NULL, *ele4 =
+        NULL;
+    axis2_om_node_t *node1 = NULL, *node2 = NULL, *node3 = NULL, *node4 =
+        NULL, *node5 = NULL, *node6 = NULL;
+    axis2_om_attribute_t *attr1 = NULL, *attr2 = NULL;
+    axis2_om_namespace_t *ns1 = NULL, *ns2 = NULL, *ns3 = NULL;
+    axis2_om_text_t *text1 = NULL;
+    axis2_om_output_t *om_output = 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 (&environment, NULL, "book", ns1, &node1);
+    AXIS2_OM_ELEMENT_DECLARE_NAMESPACE(ele1,&environment,node1,ns2);
+    
+    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 (&environment, node1, "number", ns2, &node4);
+    
+    text1 = axis2_om_text_create (&environment, node4, "1748491379", &node5);
+    
+    ele4 = axis2_om_element_create (&environment, node1, "author", ns1, &node6);
+    
+    attr1 = axis2_om_attribute_create (&environment, "title", "Mr", ns1);
+    
+    AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(ele4, &environment,attr1);
+    
+    attr2 = axis2_om_attribute_create (&environment, "name", "Axitoc Oman", ns1);
+    
+    AXIS2_OM_ELEMENT_ADD_ATTRIBUTE(ele4,&environment, attr2);
+    
+   
+    /* serializing stuff */
+    om_output = axis2_om_output_create (&environment, NULL);
+
+    printf ("Serialize built document\n");
+    status = AXIS2_OM_NODE_SERIALIZE (node1,&environment ,om_output);
+    if (status != AXIS2_SUCCESS)
+    {
+        printf ("\naxis2_om_node_serialize failed\n");
+        return status;
+    }
+    else
+        printf ("\naxis2_om_node_serialize success\n");
+    /* end serializing stuff */
+
+     AXIS2_OM_NODE_FREE_TREE(node1,&environment);
+     axis2_om_output_free(om_output, &environment);
+     printf ("\nDONE\n");
+
+    return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+    char *file_name = "test.xml";
+    if (argc > 1)
+        file_name = argv[1];
+    allocator = axis2_allocator_init (NULL);
+    axis_log = axis2_log_create(allocator, NULL);
+    error = axis2_error_create(allocator);
+    
+    stream = axis2_stream_create(allocator, NULL);
+    
+    environment = axis2_env_create_with_error_stream_log(allocator, error, stream, axis_log);
+    test_om_build (file_name);
+    test_om_serialize (); 
+    test_om_build (file_name);
+    test_om_serialize (); 
+    axis2_env_free(environment); 
+    return 0;
+ }
+

Added: webservices/axis2/trunk/c/modules/test/xml/om/text.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/text.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/text.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/text.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<foo>
+	<bar>
+		baz
+		<cheese id="3"/>
+		baz
+		<cheese/>
+		baz
+	</bar>
+</foo>

Added: webservices/axis2/trunk/c/modules/test/xml/om/underscore.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/underscore.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/underscore.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/underscore.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0" ?>
+<root a="1" _a="2">
+  <b>1</b>
+  <_b>2</_b>
+</root>
+  

Added: webservices/axis2/trunk/c/modules/test/xml/om/web.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/web.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/web.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/web.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app>
+  <servlet>
+    <servlet-name>snoop</servlet-name>
+    <servlet-class>SnoopServlet</servlet-class>
+  </servlet>
+  <servlet>
+    <servlet-name>file</servlet-name>
+    <servlet-class>ViewFile</servlet-class>
+    <init-param>
+      <param-name>initial</param-name>
+      <param-value>
+        1000
+      </param-value>
+      <description>
+        The initial value for the counter  <!-- optional -->
+      </description>
+    </init-param>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>
+      mv
+    </servlet-name>
+    <url-pattern>
+      *.wm
+    </url-pattern>
+  </servlet-mapping>
+
+  <distributed/>
+
+  <security-role>
+    <role-name>
+     manager
+    </role-name>
+    <role-name>
+     director
+    </role-name>
+    <role-name>
+     president
+    </role-name>
+  </security-role>
+</web-app>

Added: webservices/axis2/trunk/c/modules/test/xml/om/web2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/test/xml/om/web2.xml?rev=351636&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/test/xml/om/web2.xml (added)
+++ webservices/axis2/trunk/c/modules/test/xml/om/web2.xml Fri Dec  2 00:26:54 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<root>
+  <b>
+    <d />
+  </b>
+  <c />
+</root>



Mime
View raw message