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/14 15:16:04 UTC
svn commit: r321104 - in /webservices/axis2/trunk/c/modules/xml/om/src:
axis2_om_document.c axis2_om_element.c axis2_om_stax_builder.c
Author: samisa
Date: Fri Oct 14 06:15:57 2005
New Revision: 321104
URL: http://svn.apache.org/viewcvs?rev=321104&view=rev
Log:
Fixed compilation problems and naming on stax builder
Modified:
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.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_document.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c?rev=321104&r1=321103&r2=321104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c Fri Oct 14 06:15:57 2005
@@ -1,168 +1,168 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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 <axis2_om_document.h>
-#include <stdlib.h>
-#include <axis2_error.h>
-#include <axis2_defines.h>
-#include <axis2_stax_ombuilder.h>
-
-axis2_om_document_t *axis2_om_document_create(axis2_om_node_t * root_ele,axis2_stax_om_builder_t * builder)
-{
-
- axis2_om_document_t *doc = (axis2_om_document_t *) malloc(sizeof(axis2_om_document_t));
- if (!doc)
- {
- /*fprintf(stderr,"%d Error",AXIS2_ERROR_NO_MEMORY);*/
- return NULL;
- }
- doc->builder = builder;
- doc->root_element = root_ele;
- doc->first_child = NULL;
- doc->last_child = NULL;
- doc->char_set_encoding = CHAR_SET_ENCODING;
- doc->xml_version = XML_VERSION;
- doc->done = AXIS2_FALSE;
- if(builder)
- {
- builder->document=doc;
- }
- return doc;
-}
-
-
-void axis2_free_om_document(axis2_om_document_t * doc)
-{
- if(doc)
- {
- if(doc->char_set_encoding)
- free(doc->char_set_encoding);
- if(doc->xml_version)
- free(doc->xml_version);
- /* */
-
- free(doc);
- }
-}
-
-
-void axis2_om_document_set_char_set_encoding(axis2_om_document_t *document,
- const char *char_set_encoding)
-{
- if (document)
- {
- if (document->char_set_encoding)
- {
- free(document->char_set_encoding);
- }
- document->char_set_encoding = strdup(char_set_encoding);
- }
-}
-
-void axis2_om_document_add_child(axis2_om_document_t * document,
- axis2_om_node_t * child)
-{
- if(!(document->root_element) && child)
- {
- document->root_element = child;
-
- }
-
- if(document->root_element && child)
- {
- axis2_om_node_add_child(document->root_element,child);
- }
-
-}
-
-
-void axis2_om_document_set_xmlversion(axis2_om_document_t *document,const char *xmlversion)
-{
- if(document)
- {
- if(document->xml_version)
- {
- free(document->xml_version);
- }
- document->xml_version = strdup(xmlversion);
- }
-}
-
-
-void axis2_om_document_build_next(axis2_om_document_t *document)
-{
- /* printf("next");*/
- axis2_stax_om_builder_next(document->builder);
-}
-
-
-axis2_om_node_t *axis2_om_document_get_root_element(axis2_om_document_t *document)
-{
- if(document && document->root_element)
- {
- return document->root_element;
- }
- else
- {
- while(!document->root_element)
- axis2_om_document_build_next(document);
- }
-
- return document->root_element;
-
-}
-
-axis2_om_node_t *axis2_om_document_get_next_sibling(axis2_om_document_t *document)
-{
- axis2_om_node_t *lastchild =document->builder->lastnode;
- if(document && document->builder && document->builder->lastnode)
- {
-
- if(!(lastchild->parent))
- {
- /* if parent is null there can't be siblings */
- return NULL;
- }
- while( !(lastchild->next_sibling) && !(lastchild->parent->done))
- axis2_om_document_build_next(document);
- }
- return lastchild->next_sibling;
-}
-
-axis2_om_node_t *axis2_om_document_get_first_child(axis2_om_document_t *document)
-{
- axis2_om_node_t *current_child = NULL;
- current_child = document->builder->lastnode;
- if(current_child)
- {
- while(!(current_child->first_child)&& !(current_child->done))
- {
- axis2_om_document_build_next(document);
- }
- if(current_child->first_child)
- return current_child->first_child;
- else
- return NULL;
-
- }
-
-}
-
-axis2_om_node_t *axis2_om_document_get_child(axis2_om_document_t *document)
-{
- return document->builder->lastnode;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 <axis2_om_document.h>
+#include <stdlib.h>
+#include <axis2_error.h>
+#include <axis2_defines.h>
+#include <axis2_om_stax_builder.h>
+
+axis2_om_document_t *axis2_om_document_create(axis2_om_node_t * root_ele,axis2_om_stax_builder_t * builder)
+{
+
+ axis2_om_document_t *doc = (axis2_om_document_t *) malloc(sizeof(axis2_om_document_t));
+ if (!doc)
+ {
+ /*fprintf(stderr,"%d Error",AXIS2_ERROR_NO_MEMORY);*/
+ return NULL;
+ }
+ doc->builder = builder;
+ doc->root_element = root_ele;
+ doc->first_child = NULL;
+ doc->last_child = NULL;
+ doc->char_set_encoding = CHAR_SET_ENCODING;
+ doc->xml_version = XML_VERSION;
+ doc->done = AXIS2_FALSE;
+ if(builder)
+ {
+ builder->document=doc;
+ }
+ return doc;
+}
+
+
+void axis2_free_om_document(axis2_om_document_t * doc)
+{
+ if(doc)
+ {
+ if(doc->char_set_encoding)
+ free(doc->char_set_encoding);
+ if(doc->xml_version)
+ free(doc->xml_version);
+ /* */
+
+ free(doc);
+ }
+}
+
+
+void axis2_om_document_set_char_set_encoding(axis2_om_document_t *document,
+ const char *char_set_encoding)
+{
+ if (document)
+ {
+ if (document->char_set_encoding)
+ {
+ free(document->char_set_encoding);
+ }
+ document->char_set_encoding = strdup(char_set_encoding);
+ }
+}
+
+void axis2_om_document_add_child(axis2_om_document_t * document,
+ axis2_om_node_t * child)
+{
+ if(!(document->root_element) && child)
+ {
+ document->root_element = child;
+
+ }
+
+ if(document->root_element && child)
+ {
+ axis2_om_node_add_child(document->root_element,child);
+ }
+
+}
+
+
+void axis2_om_document_set_xmlversion(axis2_om_document_t *document,const char *xmlversion)
+{
+ if(document)
+ {
+ if(document->xml_version)
+ {
+ free(document->xml_version);
+ }
+ document->xml_version = strdup(xmlversion);
+ }
+}
+
+
+void axis2_om_document_build_next(axis2_om_document_t *document)
+{
+ /* printf("next");*/
+ axis2_stax_om_builder_next(document->builder);
+}
+
+
+axis2_om_node_t *axis2_om_document_get_root_element(axis2_om_document_t *document)
+{
+ if(document && document->root_element)
+ {
+ return document->root_element;
+ }
+ else
+ {
+ while(!document->root_element)
+ axis2_om_document_build_next(document);
+ }
+
+ return document->root_element;
+
+}
+
+axis2_om_node_t *axis2_om_document_get_next_sibling(axis2_om_document_t *document)
+{
+ axis2_om_node_t *lastchild =document->builder->lastnode;
+ if(document && document->builder && document->builder->lastnode)
+ {
+
+ if(!(lastchild->parent))
+ {
+ /* if parent is null there can't be siblings */
+ return NULL;
+ }
+ while( !(lastchild->next_sibling) && !(lastchild->parent->done))
+ axis2_om_document_build_next(document);
+ }
+ return lastchild->next_sibling;
+}
+
+axis2_om_node_t *axis2_om_document_get_first_child(axis2_om_document_t *document)
+{
+ axis2_om_node_t *current_child = NULL;
+ current_child = document->builder->lastnode;
+ if(current_child)
+ {
+ while(!(current_child->first_child)&& !(current_child->done))
+ {
+ axis2_om_document_build_next(document);
+ }
+ if(current_child->first_child)
+ return current_child->first_child;
+ else
+ return NULL;
+
+ }
+
+}
+
+axis2_om_node_t *axis2_om_document_get_child(axis2_om_document_t *document)
+{
+ return document->builder->lastnode;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c?rev=321104&r1=321103&r2=321104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c Fri Oct 14 06:15:57 2005
@@ -92,7 +92,7 @@
axis2_om_element_t *
axis2_om_element_create_with_builder (axis2_om_node_t * parent,
const char *localname,axis2_om_namespace_t * ns
- ,axis2_stax_om_builder_t * builder,axis2_om_node_t **element_node)
+ ,axis2_om_stax_builder_t * builder,axis2_om_node_t **element_node)
{
axis2_om_node_t *node;
axis2_om_element_t *element;
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=321104&r1=321103&r2=321104&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 Fri Oct 14 06:15:57 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <axis2_stax_ombuilder.h>
+#include <axis2_om_stax_builder.h>
#include <axis2_om_node.h>
#include <stdlib.h>
#include <namespace.h>
@@ -50,10 +50,10 @@
return n;
}
-axis2_stax_om_builder_t *axis2_stax_om_builder_create(XML_PullParser *parser)
+axis2_om_stax_builder_t *axis2_om_stax_builder_create(XML_PullParser *parser)
{
axis2_om_document_t *document;
- axis2_stax_om_builder_t *builder = (axis2_stax_om_builder_t*)malloc(sizeof(axis2_stax_om_builder_t));
+ axis2_om_stax_builder_t *builder = (axis2_om_stax_builder_t*)malloc(sizeof(axis2_om_stax_builder_t));
if(!builder)
{
fprintf(stderr," %d Error ",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
@@ -69,8 +69,8 @@
}
-axis2_om_node_t *axis2_stax_om_builder_create_om_element(
- axis2_stax_om_builder_t *builder)
+axis2_om_node_t *axis2_om_stax_builder_create_om_element(
+ axis2_om_stax_builder_t *builder)
{
axis2_om_node_t *element_node;
char *localname = XML_PullParser_getName(builder->parser);
@@ -94,16 +94,16 @@
builder->lastnode->first_child = element_node;
element_node->parent = builder->lastnode;
}
- axis2_stax_om_builder_process_attributes(builder,element_node);
- axis2_stax_om_builder_process_namespace_data(builder,element_node,0);
+ axis2_om_stax_builder_process_attributes(builder,element_node);
+ axis2_om_stax_builder_process_namespace_data(builder,element_node,0);
// process attributes
return element_node;
}
-axis2_om_node_t *axis2_stax_om_builder_create_om_comment(
- axis2_stax_om_builder_t *builder)
+axis2_om_node_t *axis2_om_stax_builder_create_om_comment(
+ axis2_om_stax_builder_t *builder)
{
/* guththila does not support yet*/
@@ -111,22 +111,22 @@
}
-axis2_om_node_t *axis2_stax_om_builder_create_om_doctype(
- axis2_stax_om_builder_t *builder)
+axis2_om_node_t *axis2_om_stax_builder_create_om_doctype(
+ axis2_om_stax_builder_t *builder)
{
/* guththila does not support yet */
return NULL;
}
-axis2_om_node_t *axis2_stax_om_builder_create_om_processing_instruction(
- axis2_stax_om_builder_t *builder)
+axis2_om_node_t *axis2_om_stax_builder_create_om_processing_instruction(
+ axis2_om_stax_builder_t *builder)
{
/* guththila does not support yet */
return NULL;
}
-void axis2_stax_om_builder_end_element(axis2_stax_om_builder_t *builder)
+void axis2_om_stax_builder_end_element(axis2_om_stax_builder_t *builder)
{
axis2_om_node_t *parent;
if(builder->lastnode)
@@ -145,7 +145,7 @@
}
-int axis2_stax_om_builder_next(axis2_stax_om_builder_t *builder)
+int axis2_om_stax_builder_next(axis2_om_stax_builder_t *builder)
{
int token = 0;
@@ -169,25 +169,25 @@
case START_DOCUMENT:
{
- axis2_stax_om_builder_process_start_document(builder);
+ axis2_om_stax_builder_process_start_document(builder);
}
break;
case START_ELEMENT:
{
- builder->lastnode = axis2_stax_om_builder_create_om_element(builder);
+ builder->lastnode = axis2_om_stax_builder_create_om_element(builder);
}
break;
case END_ELEMENT:
{
- axis2_stax_om_builder_end_element(builder);
+ axis2_om_stax_builder_end_element(builder);
}
break;
case CHARACTER:
{
- builder->lastnode = axis2_stax_om_builder_create_om_text(builder);
+ builder->lastnode = axis2_om_stax_builder_create_om_text(builder);
}
break;
case COMMENT:
@@ -204,7 +204,7 @@
}
-void axis2_stax_om_builder_process_attributes(axis2_stax_om_builder_t *builder,axis2_om_node_t *element_node)
+void axis2_om_stax_builder_process_attributes(axis2_om_stax_builder_t *builder,axis2_om_node_t *element_node)
{
int i=0;
axis2_om_namespace_t *ns=NULL;
@@ -245,7 +245,7 @@
}
-axis2_om_node_t *axis2_stax_om_builder_create_om_text(axis2_stax_om_builder_t *builder)
+axis2_om_node_t *axis2_om_stax_builder_create_om_text(axis2_om_stax_builder_t *builder)
{
char *value;
axis2_om_node_t *node=NULL;
@@ -277,7 +277,7 @@
}
-void axis2_stax_om_builder_discard_element(axis2_stax_om_builder_t *builder)
+void axis2_om_stax_builder_discard_element(axis2_om_stax_builder_t *builder)
{
axis2_om_node_t *element=NULL;
axis2_om_node_t *prev_node=NULL;
@@ -312,7 +312,7 @@
builder->cache = TRUE;
}
-void axis2_stax_om_builder_process_start_document(axis2_stax_om_builder_t* builder)
+void axis2_om_stax_builder_process_start_document(axis2_om_stax_builder_t* builder)
{
/* skiping */
ATTRIBUTE *a;
@@ -340,7 +340,7 @@
-axis2_om_node_t *axis2_stax_om_builder_process_namespace_data(axis2_stax_om_builder_t *builder,axis2_om_node_t *element,int is_soap_element)
+axis2_om_node_t *axis2_om_stax_builder_process_namespace_data(axis2_om_stax_builder_t *builder,axis2_om_node_t *element,int is_soap_element)
{
int i=0;
char *nsuri = NULL;
@@ -406,24 +406,24 @@
}
-char *axis2_stax_om_builder_get_attribute_prefix(axis2_stax_om_builder_t *builder,int i)
+char *axis2_om_stax_builder_get_attribute_prefix(axis2_om_stax_builder_t *builder,int i)
{
return XML_PullParser_getAttributePrefix_by_number(builder->parser,i);
}
-char *axis2_stax_om_builder_get_attribute_name(axis2_stax_om_builder_t *builder,int i)
+char *axis2_om_stax_builder_get_attribute_name(axis2_om_stax_builder_t *builder,int i)
{
return XML_PullParser_getAttributeName_by_number(builder->parser,i);
}
-int axis2_stax_om_builder_get_attribute_count(axis2_stax_om_builder_t *builder)
+int axis2_om_stax_builder_get_attribute_count(axis2_om_stax_builder_t *builder)
{
return XML_PullParser_getAttributeCount(builder->parser);
}
-char *axis2_stax_om_builder_get_attribute_namespace(axis2_stax_om_builder_t *builder,int i)
+char *axis2_om_stax_builder_get_attribute_namespace(axis2_om_stax_builder_t *builder,int i)
{
XML_PullParser_getAttributeNamespace_by_number( builder->parser,i);
}