From 0425aadc78680e53000fd0108b540d6eca048516 Mon Sep 17 00:00:00 2001 From: gmcdonald Date: Sat, 13 Feb 2010 01:32:03 +0000 Subject: Moving axis svn, part of TLP move INFRA-2441 git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68 --- guththila/samples/guththila_writer_main.c | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 guththila/samples/guththila_writer_main.c (limited to 'guththila/samples/guththila_writer_main.c') diff --git a/guththila/samples/guththila_writer_main.c b/guththila/samples/guththila_writer_main.c new file mode 100644 index 0000000..9dc1218 --- /dev/null +++ b/guththila/samples/guththila_writer_main.c @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#define MAXA 100000 +int +main( + int argc, + char *argv[]) +{ + char *t; + axutil_allocator_t *allocator; + axutil_env_t *env; + guththila_t *parser; + char *xml = NULL; + FILE *file = NULL; + allocator = axutil_allocator_init(NULL); + env = axutil_env_create(allocator); + parser = guththila_create(env, NULL); + guththila_create_xml_stream_writer_for_memory(env, parser); + guththila_write_start_element(env, parser, "two"); + guththila_write_default_namespace(env, parser, "http://another.host.com"); + guththila_write_start_element_with_prefix_and_namespace(env, parser, "ws", + "http://www.wso2.org", "wso2"); + guththila_write_start_element_with_prefix(env, parser, "ws", "stacks"); + guththila_write_attribute_with_prefix(env, parser, "ws", "stack", "axis2"); + guththila_write_characters(env, parser, + "testadfjaldjf;ajf;lkajdfa;lkjfd;ajdf11111111111122334455"); + guththila_write_end_document(env, parser); + + xml = (char *)AXIS2_MALLOC(env->allocator, MAXA + 1); + memset(xml, 0, MAXA + 1); + if(!argv[1]) + { + file = fopen("/home/dinesh/tmp/mbox_backup/mbox.archived", "r"); + } + else + file = fopen(argv[1], "r"); + + if(file) + fread(xml, 1, MAXA, file); + + guththila_write_to_buffer(env, parser, xml); + t = guththila_writer_get_buffer(env, parser->xsw->writer); + printf("%s \n", t); + free(xml); + fclose(file); + guththila_xml_writer_free(env, parser); + guththila_free(env, parser); + axutil_env_free(env); + return 0; +} -- cgit v1.1-32-gdbae