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 di...@apache.org on 2006/10/27 06:29:25 UTC

svn commit: r468268 [4/6] - in /webservices/axis2/site/c: ./ docs/ docs/hello/ docs/hello/client/ docs/hello/service/ docs/hello/service/hello/

Modified: webservices/axis2/site/c/docs/om_tutorial.html
URL: http://svn.apache.org/viewvc/webservices/axis2/site/c/docs/om_tutorial.html?view=diff&rev=468268&r1=468267&r2=468268
==============================================================================
--- webservices/axis2/site/c/docs/om_tutorial.html (original)
+++ webservices/axis2/site/c/docs/om_tutorial.html Thu Oct 26 21:29:24 2006
@@ -2,7 +2,7 @@
           @import url("../style/maven-base.css");
           
 			    @import url("../style/maven-classic.css");</style><link rel="stylesheet" href="../style/print.css" type="text/css" media="print"></link><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta></head><body class="composite"><div id="banner"><a href="http://www.apache.org/" id="organizationLogo"><img alt="Apache Software Foundation" src="http://www.apache.org/images/asf-logo.gif"></img></a><a href="http://ws.apache.org/axis2/c" id="projectLogo"><img alt="Apache Axis2 C" src="http://ws.apache.org/axis2/images/axis.jpg"></img></a><div class="clear"><hr></hr></div></div><div id="breadcrumbs"><div class="xleft">
-                	Last published: 04 October 2006
+                	Last published: 27 October 2006
                   | Doc for 0.94</div><div class="xright"></div><div class="clear"><hr></hr></div></div><div id="leftColumn"><div id="navcolumn"><div id="menuAxis2_C"><h5>Axis2/C</h5><ul><li class="none"><a href="../index.html">Home</a></li><li class="expanded"><a href="../download.cgi">Download Axis2/C</a><ul><li class="none"><a href="../download.cgi">Releases</a></li><li class="none"><a href="http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/c/" class="externalLink" title="External Link">View Source Code Online</a></li><li class="none"><a href="../svn.html">Checkout Source Code</a></li></ul></li><li class="none"><a href="../docs/index.html">Documentation</a></li><li class="expanded"><a href="../mail-lists.html">Get Involved</a><ul><li class="none"><a href="../mail-lists.html">Mailing Lists</a></li></ul></li><li class="expanded"><a href="../team-list.html">Project Information</a><ul><li class="none"><a href="../team-list.html">Project Team</a></li><li class="none"><
 a href="../issue-tracking.html">Issue Tracking</a></li></ul></li></ul></div><a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy"><img alt="Built by Maven" src="../images/logos/maven-button-1.png"></img></a></div></div><div id="bodyColumn"><div class="contentBox"><div class="section"><a name="Axis2_C_OM_Tutorial"></a><h2>Axis2/C OM Tutorial</h2><div class="subsection"><a name="Content"></a><h3>Content</h3><ul>
   <li><a href="#Introduction">Introduction</a>
     <ul>
@@ -17,13 +17,13 @@
   </li>
   <li><a href="#Working_with_OM">Working with OM</a>
     <ul>
-      <li><a href="#Env">Axis2/C environment</a></li>
+      <li><a href="#Env">Axis2/C Environment</a></li>
       <li><a href="#Creation">Creation</a></li>
       <li><a href="#Addition_and_Detaching_of_Nodes">Adding and Detaching
         Nodes</a></li>
       <li><a href="#Traversing">Traversing</a></li>
       <li><a href="#Serialization">Serialization</a></li>
-      <li><a href="#Reader_and_Writer">Using axis2_xml_reader and axis2_xml_writer</a></li>
+      <li><a href="#Reader_and_Writer">Using axiom_xml_reader and axiom_xml_writer</a></li>
       <li><a href="#Mem_Leaks">How to avoid memory leaks and double frees when using OM</a></li>
       <li><a href="#Complete_Sample">Complete Sample</a></li>
     </ul>
@@ -69,11 +69,11 @@
     required. OM is based on StAX, the standard pull parser API.
     <p>Since different XML parsers offer different kinds of pull parser APIs,
     we define an API derived from StAX. That API is defined in
-    <code>axis2_xml_reader.h</code>. Similarly we define an xml writer API in
-    <code>axis2_xml_writer.h</code>. These two APIs work as an abstarction
+    <code>axiom_xml_reader.h</code>. Similarly we define an xml writer API in
+    <code>axiom_xml_writer.h</code>. These two APIs work as an abstarction
     layer between any XML parser and OM. So any parser that is going to be
-    used for OM should implement the <code>axis2_xml_reader</code> API and
-    <code>axis2_xml_writer</code> API using a wrapper layer.</p>
+    used for OM should implement the <code>axiom_xml_reader</code> API and
+    <code>axiom_xml_writer</code> API using a wrapper layer.</p>
     <p></p>
     <p>Currenly we use <code>libxml2</code> as our default XML parser.</p>
     <p></p>
@@ -84,36 +84,36 @@
 </p><p class="img"><img alt="" src="images/archi006.jpg" class="img" width="490" height="282"></img></p><p>
 
 </p><p>OM Builder wraps the raw xml character stream through the
-<code>axis2_xml_reader</code> API. Hence the complexities of the pull event
+<code>axiom_xml_reader</code> API. Hence the complexities of the pull event
 stream are covered.</p><p><a id="Where_Does_SOAP_Come_into_Play?"></a></p></div><div class="subsection"><a name="Where_does_SOAP_come_into_play_"></a><h3>Where does SOAP come into play?</h3><p>In a nutshell SOAP is an information exchange protocol based on XML. SOAP
 has a defined set of XML elements that should be used in messages. Since Axis
 is a "SOAP Engine" and OM is built for Axis, a SOAP specific API was
-implemented on top of OM.We have defined a number of structs to represent
+implemented on top of OM. We have defined a number of structs to represent
 SOAP constructs like Envelope etc., which wraps general OM structures. See <a href="http://www.w3schools.com/SOAP/soap_intro.asp" class="externalLink" title="External Link">here</a> to learn more
 about SOAP.</p><p>
-<a id="Working_with_OM"></a></p></div><div class="subsection"><a name="Working_with_OM"></a><h3>Working with OM</h3><p></p><p><a id="Env"></a></p></div><div class="subsection"><a name="Axis2_C_environment"></a><h3>Axis2/C environment</h3><p>Before starting the discussion on OM, it is necessary to get a good
-understanding of the basics of Axis2/C. Axis2/C is designed to be plugble to
-any system written in C or C++ and therefore Axis2 has abstracted the
-functionalities that differ from system to system in to a structure
+<a id="Working_with_OM"></a></p></div><div class="subsection"><a name="Working_with_OM"></a><h3>Working with OM</h3><p></p><p><a id="Env"></a></p></div><div class="subsection"><a name="Axis2_C_Environment"></a><h3>Axis2/C Environment</h3><p>Before starting the discussion on OM, it is necessary to get a good
+understanding of the basics of Axis2/C. Axis2/C is designed to be pluggable to
+any system written in C or C++ as such, Axis2 has abstracted the
+functionalities that differ from system to system into a structure
 <code>axis2_env_t</code>, which we refer to as axis2 environment . The
-environment holds <code>axis2_allocater_t</code> [ used for memory
+environment holds <code>axis2_allocator_t</code> [ used for memory
 allocation/deallocation ] , <code>axis2_error_t</code> [ error reporting
 mechanism ], <code>axis2_log_t</code> [ logging mechanism ] and
-<code>axis2_thread_t</code> [threading mechnism ].
+<code>axis2_thread_t</code> [ threading mechanism ].
 <code>axis2_allocator_t</code> has function pointers to <code>malloc</code>,
 <code>realloc</code> and <code>free</code> functions and all memory
 allocation and deallocation is done using the allocator. Therefore, by
 pluging in a different allocator, a user can make the entire Axis2 system to
 use different memory management functions.</p><p></p><p>When creating the axis2 environment, the first thing is to create the
-allocator.</p><p><code>axis2_allocator_t *allocator = NULL;</code></p><p><code>allocator = axis2_allocator_init(NULL);</code></p><p></p><p>We parse <code>NULL</code> to the above function to use the default
+allocator.</p><p><code>axis2_allocator_t *allocator = NULL;</code></p><p><code>allocator = axis2_allocator_init(NULL);</code></p><p></p><p>We pass <code>NULL</code> to the above function to use the default
 allocator. Then the allocators function pointers point to
-<code>malloc</code>, <code>realloc</code> and <code>free</code> functons. If
-you have your own allocator structure, you may pass it instead.</p><p></p><p>Convinent macros <code>AXIS2_MALLOC</code>, <code>AXIS2_REALLOC</code> and
+<code>malloc</code>, <code>realloc</code> and <code>free</code> functions. If
+you have your own allocator structure, you may pass it instead.</p><p></p><p>Convenient macros <code>AXIS2_MALLOC</code>, <code>AXIS2_REALLOC</code> and
 <code>AXIS2_FREE</code> are defined to use allocator functions (refer to
 <code>axis2_allocator.h</code> for more information).</p><p></p><p>In a similar fashion, you can create the error and log structures.</p><p><code>axis2_log_t *log = NULL;</code></p><p><code>axis2_error_t *error = NULL;</code></p><p><code>log = axis2_log_create(allocator, NULL, NULL);</code></p><p><code>log = axis2_log_create(allocator, NULL, "mylog.log");</code></p><p></p><p>Now we can create the environment by parsing the allocator, error and log
 to <code>axis2_env_create_with_error_log()</code> function.</p><p><code>axis2_env_t *env = NULL;</code></p><p><code>env = axis2_env_create_with_error_log(allocator, error,
-log);</code></p><p></p><p>Apart from the above abstraction , all other library functions used are
-ANSI C complient. Further, platform dependent funtions are also
+log);</code></p><p></p><p>Apart from the above abstraction, all other library functions used are
+ANSI C compliant. Further, platform dependent functions are also
 abstracted.</p><p></p><p>As a rule of thumb, all "<code>create</code>" functions take a pointer to
 the environment as its first argument and all other functions take pointer to
 'this' struct as the first argument and a pointer to the environment as the
@@ -122,7 +122,7 @@
 as the first argument and the pointer to the environment as the second.</p><p></p><p>All functions return a pointer to a struct or a status code [
 <code>AXIS2_SUCCESS</code> , <code>AXIS2_FAILURE</code>]. So if
 <code>NULL</code> is returned by a function it is either because there is
-nothing to return or an error has occured.</p><p></p><p><a id="Creation"></a></p></div><div class="subsection"><a name="Creation"></a><h3>Creation</h3><p>Creation is the first and foremost action when using an Object
+nothing to return or an error has occurred.</p><p></p><p><a id="Creation"></a></p></div><div class="subsection"><a name="Creation"></a><h3>Creation</h3><p>Creation is the first and foremost action when using an Object
 representation. This part explains how OM can be built either from an
 existing document or programmatically. OM provides a notion of a builder to
 create objects. Since OM is tightly bound to StAX, a StAX compliant reader
@@ -134,13 +134,13 @@
 the <code>AXIOM_NODE_GET_DATA_ELEMENT</code> macro. The type of the struct
 stored in the '<code>axiom_node_t'</code> struct can be obtained by
 <code>AXIOM_NODE_GET_NODE_TYPE</code> macro. When we create
-<code>axiom_element_t</code> , <code>axiom_text_t</code> etc .., it is
+<code>axiom_element_t</code> , <code>axiom_text_t</code> etc., it is
 required to parse a double pointer to the node struct as the last parameter
-of the <code>create</code> function so that the correponding node struct can
-be referenced using that pointer.</p><p>Eg.</p><p><code>axiom_node_t *my_node = NULL;</code></p><p><code>axiom_element_t *my_ele = NULL;</code></p><p><code>my_ele = axiom_element_create(env, NULL, "MY_ELEMENT", NULL,
+of the <code>create</code> function so that the corresponding node struct can
+be referenced using that pointer.</p><p>Example</p><p><code>axiom_node_t *my_node = NULL;</code></p><p><code>axiom_element_t *my_ele = NULL;</code></p><p><code>my_ele = axiom_element_create(env, NULL, "MY_ELEMENT", NULL,
 &amp;my_node);</code></p><p></p><p>Now if we call <code>AXIOM_NODE_GET_NODE_TYPE</code> macro on
 '<code>my_node</code>' pointer we will get the value as
-<code>AXIOM_ELEMENT</code> .</p><div>
+<code>AXIOM_ELEMENT</code>.</p><div>
 <p></p>
 
 <p><b>Code Listing 1</b></p>
@@ -154,7 +154,7 @@
 
 om_builder = axiom_stax_builder_create(env, xml_reader);
 
-soap_builder = axiom_soap_builder_create(env, om_builder , AXIOM_SOAP_ENVELOPE_NAMESPACE_URI);
+soap_builder = axiom_soap_builder_create(env, om_builder , AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI);
 
 soap_envelope = AXIOM_SOAP_BUILDER_GET_SOAP_ENVELOPE(soap_builder, env);
 </pre></div>
@@ -193,7 +193,7 @@
 reference to its builder. If this information is not available, it is due to
 the struct being created without a builder.</p><p></p><p>The SOAP struct hierarchy is made in the most natural way for a
 programmer. It acts as a wrapper layer on top of OM implementation. The SOAP
-structs wraps the correspoding <code>axiom_node_t</code> structs to store
+structs wraps the corresponding <code>axiom_node_t</code> structs to store
 information in xml.</p><p>
 <a id="Addition_and_Detaching_of_Nodes"></a></p></div><div class="subsection"><a name="Adding_and_Detaching_Nodes"></a><h3>Adding and Detaching Nodes</h3><p>Addition and removal methods are defined in the <code>axiom_node.h</code>
 header. The following are the most important in adding nodes.</p><div>
@@ -211,8 +211,8 @@
                       const axis2_env_t *env);
 
 </pre></div>
-  <p>The detach operation resets the links and remove a node from om
-structure.</p><p></p><p>This code segment shows how the addition takes place. Note that it is
+  <p>The detach operation resets the links and removes a node from OM
+structure.</p><p></p><p>This code segment shows how the addition takes place. Note,that it is
 related to the code segment shown in the creation section.</p><div>
 <p><b>Code Listing 4</b></p>
 </div>
@@ -248,7 +248,7 @@
     <code>axiom_namespace_t</code> is the struct that represents a namespace
     and we do not have setter functions. This makes the axiom namespace
     immutable.</li>
-</ul><p></p><p>Following are the important methods available in
+</ul><p></p><p>The following are the important methods available in
 <code>axiom_element</code> to handle namespaces.</p><div>
 <p><b>Code Listing 5</b></p>
 </div>
@@ -274,11 +274,11 @@
 axis2_status_t
 axiom_element_set_namespace(axiom_element_t *om_element,
                                const axis2_env_t *env,
-                               axis2_namespace_t *ns,
+                               axiom_namespace_t *ns,
                                axiom_node_t *element_node);
 
 </pre></div>
-  <p></p><p>An om_element has a namespace list [declared namespaces] and a pointer to
+  <p></p><p>An <code>om_element</code> has a namespace list [declared namespaces] and a pointer to
 its own namespace if one exists.</p><p>The <code>declare_namespace</code> function is straight forward. It adds a
 namespace to namespace declarations section. Note that a namespace
 declaration that is already added will not be added twice.</p><p><code>find_namespace</code> is a very handy method to locate a namespace
@@ -286,13 +286,13 @@
 declarations section and jumps to the parent if it's not found. The search
 progresses up the tree until a matching namespace is found or the root has
 been reached.</p><p><code>find_declared_namespace</code> can be used to search for a namespace
-in the current element's namespace declarations section.</p><p><code>set_namespace</code> sets an om_elements own namespace. [ Note that
+in the current element's namespace declarations section.</p><p><code>set_namespace</code> sets an <code>om_elements</code> own namespace. [ Note that
 an element's own namespace should be declared in its own namespace
 declarations section or in one of its parent elements. ] This method first
 searches for a matching namespace using <code>find_namespace</code> and if a
-matching namespace is not found anamespace is declared to this om_element's
-namespace declarations section before seting the own namespace reference.</p><p>The following sample code segment shows how the namespaces are dealt with
-in OM</p><div>
+matching namespace is not found, a namespace is declared to this om_element's
+namespace declarations section before setting the own namespace reference.</p><p>The following sample code segment shows how the namespaces are dealt with
+in OM.</p><div>
 <p><b>Code Listing 6</b></p>
 </div>
     <div class="source"><pre>axiom_namespace_t *ns1 = NULL;
@@ -316,7 +316,7 @@
 om_text  = axiom_text_create(env, ele1_node, "blah", &amp;text_node);
 
 </pre></div>
-  <p></p><p>Serilization of the root element produces the following XML</p>
+  <p></p><p>Serilization of the root element produces the following XML:</p>
     <div class="source"><pre>&lt;x:root xmlns:x="bar"&gt;
   &lt;y:foo xmlns:y="bar1"&gt;
         blah
@@ -350,7 +350,7 @@
   <p></p><p><a id="Traversing"></a></p></div><div class="subsection"><a name="Traversing"></a><h3>Traversing</h3><p>Traversing the OM structure can be done by obtaining an iterator struct.
 You can either call the appropriate function on an OM element or create the
 iterator manually. OM C offers three iterators to traverse the OM structure.
-They are</p><ul>
+They are:</p><ul>
   <li>axiom_children_iterator_t</li>
   <li>axiom_child_element_iterator_t</li>
   <li>axiom_children_qname_iterator_t</li>
@@ -389,30 +389,30 @@
 <code>AXIOM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME()</code> method returns the
 first child that matches the given <code>axis2_qname_t</code> and
 <code>AXIOM_ELEMENT_GET_CHILDREN_WITH_QNAME()</code> returns
-<code>axiom_children_qname_iterator_t</code> which can be used to travese all
+<code>axiom_children_qname_iterator_t</code> which can be used to traverse all
 the matching children. The advantage of these iterators are that they won't
 build the whole object structure at once; it builds only what is required.</p><p></p><p>
 
 <table class="bodyTable"><tbody>
-    <tr class="b"><td><img src="images/OM005.gif" alt="" width="35" height="57"></img></td><td class="special-td">All iterator implementations internally stay one
+    <tr class="a"><td><img src="images/OM005.gif" alt="" width="35" height="57"></img></td><td class="special-td">All iterator implementations internally stay one
         step ahead of their apparent location to provide the correct value
         for the <code>HAS_NEXT()</code> function . This hidden advancement
         can build elements that are not intended to be built at all.</td><td></td></tr>
   </tbody></table>
 
 </p><p></p><p><a id="Serialization"></a></p></div><div class="subsection"><a name="Serialization"></a><h3>Serialization</h3><p>OM can be serialized using <code>AXIOM_NODE_SERIALIZE</code> macro .The
-serialization uses <code>axis2_xml_writer.h</code> and
-<code>axiom_output.h</code> APIs.</p><p></p><p>Here is an example that shows how to write the output to the console, (We
-serialize the SOAP envelope created in code listing 1).</p><div>
+serialization uses <code>axiom_xml_writer.h</code> and
+<code>axiom_output.h</code> APIs.</p><p></p><p>Here is an example that shows how to write the output to the console (we have
+serialized the SOAP envelope created in code listing 1).</p><div>
 <p><b>Code Listing 8</b></p>
 </div>
-    <div class="source"><pre>axis2_xml_writer_t *xml_writer = NULL;
+    <div class="source"><pre>axiom_xml_writer_t *xml_writer = NULL;
 axiom_output_t *om_output = NULL;
 axis2_char_t *buffer = NULL;
 
 ..............
 
-xml_writer = axis2_xml_writer_create(env, NULL, 0, 0);
+xml_writer = axiom_xml_writer_create(env, NULL, 0, 0);
 om_output = axiom_output_create(env, xml_writer);
 
 AXIOM_SOAP_ENVELOPE_SERIALIZE(envelope, env, om_output);
@@ -421,7 +421,7 @@
 
 </pre></div>
   <p></p><p>An easy way to serialize is to use the <code>to_string</code> function in
-om_element</p><p></p><p><b>Code Listing 9</b></p>
+<code>om_element</code></p><p></p><p><b>Code Listing 9</b></p>
     <div class="source"><pre>axis2_char_t *xml_output = NULL; 
 axiom_node_t *foo_node = NULL;
 axiom_element_t *foo_ele = NULL;
@@ -439,41 +439,40 @@
 AXIS2_FREE(env-&gt;allocator, xml_output);
 
 </pre></div>
-  <p></p><p>Note that freeing the returned buffer is user's responsibility.</p><p></p><p><a id="Reader_and_Writer"></a></p></div><div class="subsection"><a name="Using_axis2_xml_reader_and_axis2_xml_writer"></a><h3>Using axis2_xml_reader and axis2_xml_writer</h3><p><code>axis2_xml_reader</code> provides three create functions that and can
+  <p></p><p>Note that freeing the returned buffer is user's responsibility.</p><p></p><p><a id="Reader_and_Writer"></a></p></div><div class="subsection"><a name="Using_axiom_xml_reader_and_axiom_xml_writer"></a><h3>Using axiom_xml_reader and axiom_xml_writer</h3><p><code>axiom_xml_reader</code> provides three create functions that can
 be used for different xml input sources.</p><ul>
-  <li><code>axis2_xml_reader_create_for_file</code> functon can be used to
+  <li><code>axiom_xml_reader_create_for_file</code> function can be used to
     read from a file.</li>
-  <li><code>axis2_xml_reader_create_for_io</code> uses a user defined
+  <li><code>axiom_xml_reader_create_for_io</code> uses a user defined
     callback function to pull xml.</li>
-  <li><code>axis2_xml_reader_create_for_memory</code> can be used to read
+  <li><code>axiom_xml_reader_create_for_memory</code> can be used to read
     from an xml string that is in a character buffer.</li>
-</ul><p></p><p>Similarly <code>axis2_xml_writer</code> provides two create functions.</p><ul>
-  <li><code>axis2_xml_writer_create_for_file</code> can be used to write to a
+</ul><p></p><p>Similarly <code>axiom_xml_writer</code> provides two create functions.</p><ul>
+  <li><code>axiom_xml_writer_create_for_file</code> can be used to write to a
     file.</li>
-  <li><code>axis2_xml_writer_create_for_memory</code> can be used to write to
-    an internal memory buffer and obtain the xml string to a charcater buffer
+  <li><code>axiom_xml_writer_create_for_memory</code> can be used to write to
+    an internal memory buffer and obtain the xml string to a character buffer
     as the output.</li>
-</ul><p></p><p>Please refer to <code>axis2_xml_reader.h</code> and
-<code>axis2_xml_writer.h</code> for more information.</p><p></p><p><a id="Mem_Leaks"></a></p></div><div class="subsection"><a name="How_to_avoid_memory_leaks_and_double_frees_when_using_OM"></a><h3>How to avoid memory leaks and double frees when using OM</h3><p>You have to be extremely carefull when using om in order to avoid memory
-leaks and double free errors. Following guidelines will be very useful.</p><p>1. <code>om_element_t</code> struct keeps a list of attributes and a list
+</ul><p></p><p>Please refer to <code>axiom_xml_reader.h</code> and
+<code>axiom_xml_writer.h</code> for more information.</p><p></p><p><a id="Mem_Leaks"></a></p></div><div class="subsection"><a name="How_to_Avoid_Memory_Leaks_and_Double_Frees_When_Using_OM"></a><h3>How to Avoid Memory Leaks and Double Frees When Using OM</h3><p>You have to be extremely careful when using OM, in order to avoid memory
+leaks and double free errors. The following guidelines will be extremely useful:</p><p>1. <code>om_element_t</code> struct keeps a list of attributes and a list
 of namespaces, when a namespace pointer is added to this list , it will be
-freed when this om_element is freed, Therefore same pointer to a namespace or
+freed when this <code>om_element</code> is freed, Therefore same pointer to a namespace or
 an attribute should not be passed twice to a <code>create</code> , add or
 <code>set</code> function.</p><p>To avoid the inconvenience, clone functions have been implemented for both
-axiom_namespace and axiom_attribute structures.</p><p></p><p>2. OM returns shallow references to its string values. Therefore when
-using the returned values, AXIS2_STRDUP () function should be used to avoid
+<code>axiom_namespace</code> and <code>axiom_attribute</code> structures.</p><p></p><p>2. OM returns shallow references to its string values. Therefore, when
+using the returned values, <code>AXIS2_STRDUP ()</code> function should be used to avoid
 double free errors, if the returned value is going to be set to another
-struct.</p><p>Eg.:</p><p><code>axiom_namespace_t *ns = NULL;</code></p><p><code>axis2_char_t *uri = NULL;</code></p><p><code>ns = axiom_namespace_create(env, "http://ws.apache.org",
+struct.</p><p>Example</p><p><code>axiom_namespace_t *ns = NULL;</code></p><p><code>axis2_char_t *uri = NULL;</code></p><p><code>ns = axiom_namespace_create(env, "http://ws.apache.org",
 "om");</code></p><p><code>uri = AXIOM_NAMESPACE_GET_URI(ns, env);</code></p><p><code>/** now uri points to the same place where namespace structs uri
-pointer is pointing */</code></p><p><code>Therefore following will cause a double free */</code></p><p><code>AXIS2_FREE(env-&gt;allocator, uri);</code></p><p><code>AXIOM_NAMESPACE_FREE(ns, env);</code></p><p></p><p>3. when creating om programatically , if you are declaring a namespace to
-an om elment, it is advisible to find whether the namespace is already
-availble in the elements scope using find_namespace function. If available,
+pointer is pointing */</code></p><p><code>Therefore following will cause a double free */</code></p><p><code>AXIS2_FREE(env-&gt;allocator, uri);</code></p><p><code>AXIOM_NAMESPACE_FREE(ns, env);</code></p><p></p><p>3. When creating OM programatically , if you are declaring a namespace to
+an OM element, it is advisable to find whether the namespace is already
+available in the elements scope using <code>find_namespace</code> function. If available,
 that pointer can be used instead of creating another namespace struct
-instance to prevent memory leaks.</p><p></p><p><a id="Complete_Sample"></a></p></div><div class="subsection"><a name="Complete_code_for_the_OM_based_document_building_and_serialization"></a><h3>Complete code for the OM based document building and serialization</h3><p>The following code segment shows how to use the OM for completely building
+instance to prevent memory leaks.</p><p></p><p><a id="Complete_Sample"></a></p></div><div class="subsection"><a name="Complete_Code_for_the_OM_Based_Document_Building_and_Serialization"></a><h3>Complete Code for the OM Based Document Building and Serialization</h3><p>The following code segment shows how to use the OM for completely building
 a document and then serializing it into text pushing the output to the
 console.</p><div>
 <p></p>
-
 <p><b>Code Listing 10</b></p>
 </div>
     <div class="source"><pre>#include &lt;axiom_node.h&gt;
@@ -482,17 +481,15 @@
 #include &lt;axiom_element.h&gt;
 #include &lt;axiom_document.h&gt;
 #include &lt;axiom_stax_builder.h&gt;
-#include &lt;axis2_xml_reader.h&gt;
+#include &lt;axiom_xml_reader.h&gt;
 #include &lt;axis2_log_default.h&gt;
 #include &lt;axis2_error_default.h&gt;
-#include &lt;axis2_xml_writer.h&gt;
+#include &lt;axiom_xml_writer.h&gt;
 #include &lt;axiom_output.h&gt;
 #include &lt;stdio.h&gt;
 
-
 FILE *f = NULL;
 int read_input_callback(char *buffer, int size, void* ctx)
-
 {
      fread(buffer, (char), size, f);
 }
@@ -500,9 +497,7 @@
 {
      fclose(f);
 }
-
 axis2_env_t * create_environment()
-
 {
     axis2_allocator_t *allocator = NULL;
     axis2_env_t *env = NULL;
@@ -525,14 +520,14 @@
     axiom_document_t *document = NULL;
     axiom_stax_builder_t *om_builder = NULL;
 
-    axis2_xml_reader_t *xml_reader = NULL;
-    axis2_xml_writer_t *xml_writer = NULL;
+    axiom_xml_reader_t *xml_reader = NULL;
+    axiom_xml_writer_t *xml_writer = NULL;
     axiom_output_t *om_output = NULL;
 
     axis2_char_t *buffer = NULL;
     
     f = fopen("test.xml","r");
-    xml_reader = axis2_xml_reader_create_for_io(env, read_input_callback,
+    xml_reader = axiom_xml_reader_create_for_io(env, read_input_callback,
                                                     close_input_callback, NULL, NULL);
     (!xml_reader)
          -1;
@@ -569,7 +564,7 @@
     }
     AXIOM_DOCUMENT_BUILD_ALL(document, env);
     
-    xml_writer = axis2_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
+    xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
     
     om_output = axiom_output_create(env, xml_writer);
     



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org