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/24 12:13:26 UTC
svn commit: r328022 - in /webservices/axis2/trunk/c/modules/xml/om/src:
axis2_om_output.c axis2_om_stax_builder.c
Author: samisa
Date: Mon Oct 24 03:13:17 2005
New Revision: 328022
URL: http://svn.apache.org/viewcvs?rev=328022&view=rev
Log:
Added new API of guththila
Modified:
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c?rev=328022&r1=328021&r2=328022&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_output.c Mon Oct 24 03:13:17 2005
@@ -18,6 +18,9 @@
#include <stdarg.h>
#include <guththila_xml_stream_writer.h>
+guththila_environment_t *om_output_guththila_environment = NULL;
+guththila_allocator_t *om_output_guththila_allocator = NULL;
+
axis2_om_output_t *
axis2_create_om_output (axis2_environment_t * environment, void *xml_writer)
{
@@ -35,9 +38,14 @@
if (xml_writer)
om_output->xml_writer = xml_writer;
else
- om_output->xml_writer = guththila_create_xml_stream_writer (stdout,
+ {
+
+ om_output_guththila_allocator = guththila_allocator_init(NULL);
+ om_output_guththila_environment = guththila_environment_create(om_output_guththila_allocator,NULL,NULL,NULL,NULL);
+ om_output->xml_writer = guththila_create_xml_stream_writer (om_output_guththila_environment, stdout,
DEFAULT_CHAR_SET_ENCODING,
AXIS2_TRUE);
+ }
om_output->do_optimize = AXIS2_FALSE;
om_output->mime_boundary = 0;
om_output->root_content_id = 0;
@@ -77,12 +85,12 @@
{
case 0:
status =
- guththila_xml_stream_writer_write_end_element (om_output->
+ guththila_xml_stream_writer_write_end_element (om_output_guththila_environment, om_output->
xml_writer);
break;
case 1:
status =
- guththila_xml_stream_writer_write_start_element (om_output->
+ guththila_xml_stream_writer_write_start_element (om_output_guththila_environment, om_output->
xml_writer,
args_list
[0]);
@@ -90,12 +98,12 @@
case 2:
status =
guththila_xml_stream_writer_write_start_element_with_namespace
- (om_output->xml_writer, args_list[0], args_list[1]);
+ (om_output_guththila_environment, om_output->xml_writer, args_list[0], args_list[1]);
break;
case 3:
status =
guththila_xml_stream_writer_write_start_element_with_namespace_prefix
- (om_output->xml_writer, args_list[0], args_list[1],
+ (om_output_guththila_environment, om_output->xml_writer, args_list[0], args_list[1],
args_list[2]);
break;
}
@@ -106,7 +114,7 @@
{
case 2:
status =
- guththila_xml_stream_writer_write_attribute (om_output->
+ guththila_xml_stream_writer_write_attribute (om_output_guththila_environment, om_output->
xml_writer,
args_list[0],
args_list[1]);
@@ -114,13 +122,13 @@
case 3:
status =
guththila_xml_stream_writer_write_attribute_with_namespace
- (om_output->xml_writer, args_list[0], args_list[1],
+ (om_output_guththila_environment, om_output->xml_writer, args_list[0], args_list[1],
args_list[2]);
break;
case 4:
status =
guththila_xml_stream_writer_write_attribute_with_namespace_prefix
- (om_output->xml_writer, args_list[0], args_list[1],
+ (om_output_guththila_environment, om_output->xml_writer, args_list[0], args_list[1],
args_list[2], args_list[3]);
break;
@@ -129,14 +137,14 @@
case AXIS2_OM_NAMESPACE:
status =
- guththila_xml_stream_writer_write_namespace (om_output->
+ guththila_xml_stream_writer_write_namespace (om_output_guththila_environment, om_output->
xml_writer,
args_list[0],
args_list[1]);
break;
case AXIS2_OM_TEXT:
status =
- guththila_xml_stream_writer_write_characters (om_output->
+ guththila_xml_stream_writer_write_characters (om_output_guththila_environment, om_output->
xml_writer,
args_list[0]);
break;
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c?rev=328022&r1=328021&r2=328022&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_stax_builder.c Mon Oct 24 03:13:17 2005
@@ -19,6 +19,9 @@
#include <axis2_om_text.h>
#include <guththila_xml_pull_parser.h>
+guththila_environment_t *om_stax_builder_guththila_environment = NULL;
+guththila_allocator_t *om_stax_builder_guththila_allocator = NULL;
+
const axis2_char_t XMLNS_URI[] = "http://www.w3.org/XML/1998/namespace";
const axis2_char_t XMLNS_PREFIX[] = "xml";
@@ -52,7 +55,9 @@
else
{
/* create the default Guththila pull parser */
- guththila_reader_t *reader = guththila_reader_create (stdin);
+ om_stax_builder_guththila_allocator = guththila_allocator_init(NULL);
+ om_stax_builder_guththila_environment = guththila_environment_create(om_stax_builder_guththila_allocator, NULL, NULL, NULL, NULL);
+ guththila_reader_t *reader = guththila_reader_create (om_stax_builder_guththila_environment, stdin);
if (!reader)
{
@@ -60,7 +65,7 @@
return NULL;
}
- builder->parser = guththila_xml_pull_parser_create (reader);
+ builder->parser = guththila_xml_pull_parser_create (om_stax_builder_guththila_environment, reader);
if (!builder->parser)
{
@@ -84,7 +89,7 @@
if (!builder->ops)
{
- guththila_xml_pull_parser_free (builder->parser);
+ guththila_xml_pull_parser_free (om_stax_builder_guththila_environment, builder->parser);
axis2_free (environment->allocator, builder);
environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
return NULL;
@@ -111,16 +116,16 @@
axis2_status_t status = AXIS2_SUCCESS;
int attribute_count =
- guththila_xml_pull_parser_get_attribute_count (builder->parser);
+ guththila_xml_pull_parser_get_attribute_count (om_stax_builder_guththila_environment, builder->parser);
for (i = 0; i < attribute_count; i++)
{
uri =
guththila_xml_pull_parser_get_attribute_namespace_by_number
- (builder->parser, i);
+ (om_stax_builder_guththila_environment, builder->parser, i);
prefix =
guththila_xml_pull_parser_get_attribute_prefix_by_number
- (builder->parser, i);
+ (om_stax_builder_guththila_environment, builder->parser, i);
if (uri)
{
@@ -155,9 +160,9 @@
attribute =
axis2_om_attribute_create (environment,
guththila_xml_pull_parser_get_attribute_name_by_number
- (builder->parser, i),
+ (om_stax_builder_guththila_environment, builder->parser, i),
guththila_xml_pull_parser_get_attribute_value_by_number
- (builder->parser, i), ns);
+ (om_stax_builder_guththila_environment, builder->parser, i), ns);
status =
axis2_om_element_add_attribute (environment,
(axis2_om_element_t *)
@@ -186,7 +191,7 @@
return NULL;
}
- temp_value = guththila_xml_pull_parser_get_value (builder->parser);
+ temp_value = guththila_xml_pull_parser_get_value (om_stax_builder_guththila_environment, builder->parser);
if (!temp_value)
{
@@ -238,7 +243,7 @@
builder->cache = AXIS2_FALSE;
do
{
- while (guththila_xml_pull_parser_next (builder->parser) !=
+ while (guththila_xml_pull_parser_next (om_stax_builder_guththila_environment, builder->parser) !=
GUTHTHILA_END_ELEMENT);
}
while (!(element->done));
@@ -276,16 +281,16 @@
axis2_char_t *temp_prefix = NULL;
namespace_count =
- guththila_xml_pull_parser_get_namespacecount (builder->parser);
+ guththila_xml_pull_parser_get_namespacecount (om_stax_builder_guththila_environment, builder->parser);
for (; namespace_count > 0; namespace_count--)
{
om_ns =
axis2_om_namespace_create (environment,
guththila_xml_pull_parser_get_namespace_uri_by_number
- (builder->parser, namespace_count),
+ (om_stax_builder_guththila_environment, builder->parser, namespace_count),
guththila_xml_pull_parser_get_namespace_prefix_by_number
- (builder->parser, namespace_count));
+ (om_stax_builder_guththila_environment, builder->parser, namespace_count));
if (om_ns)
{
status =
@@ -298,7 +303,7 @@
}
}
/* set own namespace */
- temp_prefix = guththila_xml_pull_parser_get_prefix (builder->parser);
+ temp_prefix = guththila_xml_pull_parser_get_prefix (om_stax_builder_guththila_environment, builder->parser);
if (temp_prefix)
{
@@ -330,7 +335,7 @@
axis2_char_t *localname = NULL;
axis2_char_t *temp_localname =
- guththila_xml_pull_parser_get_name (builder->parser);
+ guththila_xml_pull_parser_get_name (om_stax_builder_guththila_environment, builder->parser);
if (!temp_localname)
{
@@ -447,7 +452,7 @@
return NULL;
}
- token = guththila_xml_pull_parser_next (builder->parser);
+ token = guththila_xml_pull_parser_next (om_stax_builder_guththila_environment, builder->parser);
if (!(builder->cache))
{