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 da...@apache.org on 2005/10/03 08:30:29 UTC
svn commit: r293264 - in /webservices/axis2/trunk/c: ./
modules/core/context/ modules/core/description/
modules/core/description/src/ modules/core/engine/ modules/core/engine/src/
modules/core/engine/test/ modules/xml/om/ modules/xml/om/src/ modules/xm...
Author: damitha
Date: Sun Oct 2 23:29:50 2005
New Revision: 293264
URL: http://svn.apache.org/viewcvs?rev=293264&view=rev
Log:
axis2c is replaced by axis2 in all file names and other
Added:
webservices/axis2/trunk/c/modules/core/description/src/axis2_description_param_include.c
webservices/axis2/trunk/c/modules/core/description/src/axis2_module_description.c
webservices/axis2/trunk/c/modules/core/description/src/axis2_operation_description.c
webservices/axis2/trunk/c/modules/core/description/src/axis2_parameter.c
webservices/axis2/trunk/c/modules/core/description/src/axis2_service_description.c
webservices/axis2/trunk/c/modules/core/description/src/axis2_servicegroup_description.c
webservices/axis2/trunk/c/modules/core/engine/
webservices/axis2/trunk/c/modules/core/engine/maven.xml
webservices/axis2/trunk/c/modules/core/engine/project.properties
webservices/axis2/trunk/c/modules/core/engine/project.xml
webservices/axis2/trunk/c/modules/core/engine/src/
webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c
webservices/axis2/trunk/c/modules/core/engine/test/
webservices/axis2/trunk/c/modules/core/engine/test/engine_test.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_node.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c
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_namespace.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_qname.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2_stax_ombuilder.c
Modified:
webservices/axis2/trunk/c/maven.xml
webservices/axis2/trunk/c/modules/core/context/project.properties
webservices/axis2/trunk/c/modules/core/description/project.properties
webservices/axis2/trunk/c/modules/xml/om/project.properties
webservices/axis2/trunk/c/modules/xml/om/test/om_test.c
Modified: webservices/axis2/trunk/c/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/maven.xml?rev=293264&r1=293263&r2=293264&view=diff
==============================================================================
--- webservices/axis2/trunk/c/maven.xml (original)
+++ webservices/axis2/trunk/c/maven.xml Sun Oct 2 23:29:50 2005
@@ -24,10 +24,10 @@
<property environment="env"/>
<property name="apr.home" value="${env.APR_HOME}"/>
<property name="cutest.home" value="${env.CUTEST_HOME}"/>
- <property name="axis2c.include" value="../../../"/>
+ <property name="axis2c.home" value="${env.AXIS2C_HOME}"/>
<goal name="axis2c:build-all">
<maven:reactor basedir="${basedir}"
- includes="modules/core/project.xml,modules/xml/project.xml"
+ includes="modules/common/project.xml,modules/core/project.xml,modules/xml/project.xml"
goals="build-module"
banner="Building Axis2C"
ignoreFailures="false"/>
Modified: webservices/axis2/trunk/c/modules/core/context/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/project.properties?rev=293264&r1=293263&r2=293264&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/project.properties (original)
+++ webservices/axis2/trunk/c/modules/core/context/project.properties Sun Oct 2 23:29:50 2005
@@ -18,4 +18,4 @@
freehep.nar.outtype=shared
freehep.nar.test.src=test
#freehep.nar.tests=context_test
-freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-core-context-nar-0.0
+#freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-core-context-nar-0.0
Modified: webservices/axis2/trunk/c/modules/core/description/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/project.properties?rev=293264&r1=293263&r2=293264&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/project.properties (original)
+++ webservices/axis2/trunk/c/modules/core/description/project.properties Sun Oct 2 23:29:50 2005
@@ -17,5 +17,5 @@
freehep.nar.src=src
freehep.nar.outtype=shared
freehep.nar.test.src=test
-#freehep.nar.tests=description_test
-freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-core-description-nar-0.0
+freehep.nar.tests=description_test
+#freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-core-description-nar-0.0
Added: webservices/axis2/trunk/c/modules/core/description/src/axis2_description_param_include.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/axis2_description_param_include.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/axis2_description_param_include.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/axis2_description_param_include.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,85 @@
+#include <axis2_description_param_include.h>
+#include <stdlib.h>
+
+static apr_pool_t *om_pool;
+
+axis2_description_param_include_t *create_axis2_description_param_include ()
+{
+ axis2_description_param_include_t *param_include = (axis2_description_param_include_t *)
+ malloc(sizeof(axis2_description_param_include_t));
+ if(param_include)
+ {
+ apr_pool_create (&om_pool, NULL);
+ param_include->parameters = (apr_hash_t *) axis2_apr_hash_make (om_pool);
+ if(param_include->parameters)
+ {
+ param_include->is_locked = FALSE;
+ return param_include;
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_OM_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_OM_MEMORY_ALLOCATION");
+
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_OM_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_OM_MEMORY_ALLOCATION");
+
+
+ return NULL;
+}
+
+void free_axis2_description_param_include (axis2_description_param_include_t
+ *param_include)
+{
+ if(param_include)
+ free(param_include);
+}
+
+void axis2_description_param_include_add_parameter
+ (axis2_description_param_include_t *param_include,
+ axis2_parameter_t * param)
+{
+ if(param_include)
+ {
+ if (!(param_include->parameters))
+ {
+ apr_pool_create (&om_pool, NULL);
+ param_include->parameters = (apr_hash_t *) axis2_apr_hash_make (om_pool);
+ }
+ if(param)
+ {
+ apr_hash_set (param_include->parameters, param->name, APR_HASH_KEY_STRING, param);
+ }
+ }
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_NULL_MEMORY_ACCESS
+ , "AXIS2_ERROR_NULL_MEMORY_ACCESS");
+
+}
+
+axis2_parameter_t *axis2_description_param_include_get_parameter
+ (axis2_description_param_include_t * param_include, char *name)
+{
+ if(param_include)
+ return (axis2_parameter_t *)(apr_hash_get
+ (param_include->parameters, strdup(name), APR_HASH_KEY_STRING));
+ return NULL;
+}
+
+/* To get all the parameters in a given description */
+apr_hash_t *axis2_descriptin_param_include_get_parameters
+ (axis2_description_param_include_t * param_include)
+{
+ if(param_include)
+ return param_include->parameters;
+ return NULL;
+}
+
+/* To check whether the paramter is locked at any level */
+boolean_t axis2_description_param_include_is_parameter_locked
+ (axis2_description_param_include_t * param_include, char *param_name)
+{
+ return ((axis2_parameter_t *)(apr_hash_get
+ (param_include->parameters, strdup(param_name), APR_HASH_KEY_STRING)))->is_locked;
+ return false;
+}
Added: webservices/axis2/trunk/c/modules/core/description/src/axis2_module_description.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/axis2_module_description.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/axis2_module_description.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/axis2_module_description.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1 @@
+#include <axis2_module_description.h>
Added: webservices/axis2/trunk/c/modules/core/description/src/axis2_operation_description.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/axis2_operation_description.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/axis2_operation_description.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/axis2_operation_description.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,119 @@
+#include <axis2_operation_description.h>
+
+axis2_operation_description_t
+ *create_axis2_operation_description ()
+{
+ axis2_description_param_include_t * param_include = NULL;
+ axis2_operation_description_t *operation_desc = (axis2_operation_description_t *)
+ malloc (sizeof (axis2_operation_description_t));
+ if(operation_desc)
+ {
+
+ param_include = (axis2_description_param_include_t *)
+ create_axis2_description_param_include();
+ if(param_include)
+ {
+ operation_desc->param_include = param_include;
+ operation_desc->parent = NULL;
+ return operation_desc;
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_MEMORY_ALLOCATION");
+
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_MEMORY_ALLOCATION");
+ return NULL;
+}
+
+axis2_operation_description_t
+ *create_axis2_operation_description_with_param_include (
+ axis2_description_param_include_t* param_include)
+{
+ axis2_operation_description_t *operation_desc = (axis2_operation_description_t *)
+ malloc (sizeof (axis2_operation_description_t));
+ if(operation_desc)
+ {
+ if(!param_include)
+ param_include = (axis2_description_param_include_t *)
+ create_axis2_description_param_include();
+ if(param_include)
+ {
+ operation_desc->param_include = param_include;
+ operation_desc->parent = NULL;
+ return operation_desc;
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_MEMORY_ALLOCATION");
+
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_MEMORY_ALLOCATION");
+ return NULL;
+}
+
+axis2_operation_description_t *create_axis2_operation_description_with_name
+ (axis2_description_param_include_t *param_include, axis2_qname_t *name)
+{
+ axis2_operation_description_t *operation_desc = (axis2_operation_description_t *)
+ malloc (sizeof (axis2_operation_description_t));
+ if(operation_desc)
+ {
+ if(!param_include)
+ param_include = (axis2_description_param_include_t *)
+ create_axis2_description_param_include();
+ if(param_include)
+ {
+ operation_desc->param_include = param_include;
+ if(name)
+ operation_desc->name = name;
+ operation_desc->parent = NULL;
+ return operation_desc;
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_MEMORY_ALLOCATION");
+
+ }
+ else
+ fprintf(stderr, "*** error_code:%d, %s\n", AXIS2_ERROR_MEMORY_ALLOCATION
+ , "AXIS2_ERROR_MEMORY_ALLOCATION");
+ return NULL;
+}
+
+void free_axis2_operation_description (axis2_operation_description_t
+ *operation_desc)
+{
+ if(operation_desc)
+ free(operation_desc);
+}
+
+void axis2_operation_description_add_parameter(axis2_operation_description_t
+ *operation_desc, axis2_parameter_t *param)
+{
+
+}
+
+axis2_parameter_t *axis2_operation_description_get_parameter(
+ axis2_operation_description_t *operation_desc, char *name)
+{
+}
+
+axis2_parameter_t *axis2_operation_description_get_parameters(
+ axis2_operation_description_t * operation_desc)
+{
+}
+
+void setParent(axis2_operation_description_t *operation_description
+ , axis2_service_description_t *service_description)
+{
+}
+
+axis2_service_description_t *getParent(axis2_operation_description_t
+ *operation_desc)
+{
+}
Added: webservices/axis2/trunk/c/modules/core/description/src/axis2_parameter.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/axis2_parameter.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/axis2_parameter.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/axis2_parameter.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,102 @@
+#include <axis2_parameter.h>
+
+axis2_parameter_t *axis2_parameter_create ()
+{
+ axis2_parameter_t *parameter = (axis2_parameter_t *) malloc
+ (sizeof(axis2_parameter_t));
+}
+
+axis2_parameter_t * axis2_parameter_create_with_name_value (const char *name, char *value)
+{
+
+ axis2_parameter_t *parameter = (axis2_parameter_t *) malloc
+ (sizeof(axis2_parameter_t));
+ if(parameter)
+ {
+ parameter->name = strdup (name);
+ parameter->value = strdup (value);
+ parameter->param_element = NULL;
+ parameter->type = AXIS2_PARAMETER_TEXT;
+ parameter->is_locked = FALSE;
+ return parameter;
+ }
+
+ return NULL;
+}
+
+void axis2_parameter_free (axis2_parameter_t * param)
+{
+ if(param)
+ free(param);
+}
+
+void axis2_parameter_set_name (axis2_parameter_t * param, char *name)
+{
+ if(param)
+ {
+ param->name = strdup(name);
+ }
+}
+
+char *axis2_parameter_get_name (axis2_parameter_t * param)
+{
+ if(param)
+ return param->name;
+ return NULL;
+}
+
+void axis2_parameter_set_value (axis2_parameter_t * param, void *value)
+{
+ if(param)
+ param->value = value;
+}
+
+void *axis2_parameter_get_value (axis2_parameter_t * param)
+{
+ if(param)
+ param->value;
+ return NULL;
+}
+
+boolean_t axis2_parameter_is_locked (axis2_parameter_t * param)
+{
+ if(param)
+ return param->is_locked;
+ return FALSE;
+}
+
+void axis2_parameter_set_locked (axis2_parameter_t * param,
+ boolean_t is_locked)
+{
+ if(param)
+ param->is_locked = is_locked;
+}
+
+void axis2_parameter_set_param_element (axis2_parameter_t * param,
+ axis2_om_element_t * om_element)
+{
+ if(param)
+ param->param_element = om_element;
+
+}
+
+axis2_parameter_t *axis2_parameter_get_param_element (axis2_parameter_t *
+ param)
+{
+ if(param)
+ return (axis2_parameter_t *) param->param_element;
+ return NULL;
+}
+
+void axis2_parameter_set_type (axis2_parameter_t * param, int type)
+{
+ if(param)
+ param->type = type;
+}
+
+int axis2_parameter_get_type (axis2_parameter_t * param)
+{
+ if(param)
+ return param->type;
+ return AXIS2_ERROR_NULL_MEMORY_ACCESS;
+}
Added: webservices/axis2/trunk/c/modules/core/description/src/axis2_service_description.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/axis2_service_description.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/axis2_service_description.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/axis2_service_description.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1 @@
+#include <axis2_service_description.h>
Added: webservices/axis2/trunk/c/modules/core/description/src/axis2_servicegroup_description.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/axis2_servicegroup_description.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/axis2_servicegroup_description.c (added)
+++ webservices/axis2/trunk/c/modules/core/description/src/axis2_servicegroup_description.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1 @@
+#include <axis2_servicegroup_description.h>
Added: webservices/axis2/trunk/c/modules/core/engine/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/maven.xml?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/maven.xml (added)
+++ webservices/axis2/trunk/c/modules/core/engine/maven.xml Sun Oct 2 23:29:50 2005
@@ -0,0 +1,29 @@
+<!--
+/*
+ * Copyright 2001-2004 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.
+ */
+-->
+
+<project default="all" xmlns:m="jelly:maven">
+
+ <goal name="build-sub-module">
+ <attainGoal name="nar:compile" />
+ </goal>
+ <goal name="compile-tests">
+ <attainGoal name="nar:compile-tests" />
+ </goal>
+ <goal name="all" prereqs="build-sub-module,compile-tests" />
+
+</project>
Added: webservices/axis2/trunk/c/modules/core/engine/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/project.properties?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/project.properties (added)
+++ webservices/axis2/trunk/c/modules/core/engine/project.properties Sun Oct 2 23:29:50 2005
@@ -0,0 +1,21 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 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.
+# -------------------------------------------------------------------
+
+freehep.nar.src=src
+freehep.nar.outtype=shared
+freehep.nar.test.src=test
+#freehep.nar.tests=engine_test
+#freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-core-engine-nar-0.0
Added: webservices/axis2/trunk/c/modules/core/engine/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/project.xml?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/project.xml (added)
+++ webservices/axis2/trunk/c/modules/core/engine/project.xml Sun Oct 2 23:29:50 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+/*
+ * Copyright 2001-2004 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.
+ */
+-->
+
+<project>
+ <extend>../../../project.xml</extend>
+ <id>axis2c-core-engine</id>
+ <name>ENGINE module</name>
+ <package>axis2c.core.engine.*</package>
+ <description>ENGINE project.</description>
+ <shortDescription>ENGINE project</shortDescription>
+</project>
Added: webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c (added)
+++ webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1 @@
+#include <axis2_engine_config.h>
Added: webservices/axis2/trunk/c/modules/core/engine/test/engine_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/test/engine_test.c?rev=293264&view=auto
==============================================================================
(empty)
Modified: webservices/axis2/trunk/c/modules/xml/om/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/project.properties?rev=293264&r1=293263&r2=293264&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/project.properties (original)
+++ webservices/axis2/trunk/c/modules/xml/om/project.properties Sun Oct 2 23:29:50 2005
@@ -17,5 +17,5 @@
freehep.nar.src=src
freehep.nar.outtype=shared
freehep.nar.test.src=test
-#freehep.nar.tests=om_test
-freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-xml-om-nar-0.0
+freehep.nar.tests=om_test
+#freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-xml-om-nar-0.0
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_node.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_node.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_node.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_node.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,177 @@
+/*
+ * 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_node.h>
+
+axis2_node_t *axis2_node_create()
+{
+ axis2_node_t *node = (axis2_node_t *) malloc(sizeof(axis2_node_t));
+
+ if (!node)
+ {
+ return NULL;
+ }
+
+ node->first_child = NULL;
+ node->last_child = NULL;
+ node->next_sibling = NULL;
+ node->prev_sibling = NULL;
+ node->parent = NULL;
+ node->element_type = AXIS2_OM_INVALID;
+ node->done = FALSE;
+ node->builder = NULL;
+ node->data_element = NULL;
+ return node;
+}
+
+
+void axis2_node_free(axis2_node_t * node)
+{
+ if (!node)
+ return;
+}
+
+void axis2_node_add_child(axis2_node_t * parent, axis2_node_t * child)
+{
+ if (!parent || !child)
+ {
+ return;
+ }
+ if (parent->first_child == NULL)
+ {
+ parent->first_child = child;
+ }
+ else
+ {
+ parent->last_child->next_sibling = child;
+ child->prev_sibling = parent->last_child;
+ }
+
+ child->parent = parent;
+ parent->last_child = child;
+
+}
+
+
+
+axis2_node_t *axis2_node_detach(axis2_node_t * node_to_detach)
+{
+ axis2_node_t *parent = NULL;
+
+ if (!node_to_detach)
+ {
+ return NULL;
+ }
+
+ if (!(node_to_detach->parent))
+ {
+ /* nodes that do not have a parent can't be detached */
+ return NULL;
+ }
+
+ parent = node_to_detach->parent;
+
+ if ((node_to_detach->prev_sibling) == NULL)
+ {
+ parent->first_child = node_to_detach->next_sibling;
+ }
+ else
+ {
+ node_to_detach->prev_sibling->next_sibling =
+ node_to_detach->next_sibling;
+ }
+ if (!(node_to_detach->next_sibling))
+ {
+ node_to_detach->next_sibling->prev_sibling =
+ node_to_detach->prev_sibling;
+ }
+
+ node_to_detach->parent = NULL;
+
+ return node_to_detach;
+}
+
+void axis2_node_set_parent(axis2_node_t * node,axis2_node_t *parent)
+{
+ if(!parent || !node)
+ {
+ return ;
+ }
+
+ if(parent == node->parent )
+ {/* same parent already exist */
+ return ;
+ }
+ /* if a new parent is assigned in place of existing */
+ /* one first the node should be detached */
+
+ if(!(node->parent))
+ {
+ axis2_node_detach(node);
+ }
+ node->parent = parent;
+}
+
+/**
+ * This will insert a sibling just after the current information item
+ * @param node the node in consideration
+ * @param nodeto_insert the node that will be inserted
+ */
+
+void axis2_node_insert_sibling_after(axis2_node_t *node,
+ axis2_node_t *node_to_insert)
+{
+ if(!node || !node_to_insert )
+ {
+ return ;
+ }
+ node_to_insert->parent = node->parent;
+ node_to_insert->prev_sibling = node;
+
+ if(node->next_sibling)
+ {
+ node->next_sibling->prev_sibling = node_to_insert;
+ }
+
+ node_to_insert->next_sibling = node->next_sibling;
+ node->next_sibling = node_to_insert;
+}
+
+
+void axis2_node_insert_sibling_before(axis2_node_t *node,
+ axis2_node_t *node_to_insert)
+{
+ if(!node || !node_to_insert )
+ {
+ return;
+ }
+
+ node_to_insert->parent = node->parent;
+
+ node_to_insert->prev_sibling = node->prev_sibling;
+ node_to_insert->next_sibling = node;
+
+ if(!(node->prev_sibling))
+ {
+ node->parent->first_child = node_to_insert;
+ }
+ else
+ {
+ node->prev_sibling->next_sibling = node_to_insert;
+
+ }
+ node->prev_sibling = node_to_insert;
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_attribute.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,74 @@
+/*
+ * 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_attribute.h>
+#include <string.h>
+
+
+axis2_om_attribute_t *axis2_om_attribute_create(const char *localname,
+ const char *value,axis2_om_namespace_t *ns)
+{
+ axis2_om_attribute_t *attr = (axis2_om_attribute_t *) malloc(
+ sizeof(axis2_om_attribute_t));
+ if (!attr)
+ {
+ return NULL;
+ }
+
+ attr->localname = strdup(localname);
+ attr->value = strdup(value);
+ attr->ns = ns;
+ return attr;
+}
+
+void axis2_om_attribute_free(axis2_om_attribute_t * attr)
+{
+ if (attr)
+ {
+ if(attr->localname)
+ {
+ free(attr->localname);
+ }
+ if(attr->value)
+ {
+ free(attr->value);
+ }
+ if(attr->ns)
+ {
+ axis2_om_namespace_free(attr->ns);
+ }
+ free(attr);
+ }
+
+}
+
+axis2_qname_t *axis2_om_attribute_get_qname(axis2_om_attribute_t * attr)
+{
+ axis2_qname_t *qname = NULL;
+ if (!attr)
+ {
+ return NULL;
+ }
+ if (attr->ns)
+ {
+ qname = axis2_qname_create(attr->localname, attr->ns->uri,attr->ns->prefix);
+ }
+ else
+ {
+ qname = axis2_qname_create(attr->localname, NULL, NULL);
+ }
+ return qname;
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_comment.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,88 @@
+/*
+ * 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_comment.h>
+#include <string.h>
+#include <axis2_errno.h>
+
+axis2_node_t *axis2_om_comment_create(const char *value)
+{
+ axis2_node_t *node = NULL;
+ axis2_om_comment_t *comment = NULL;
+
+ node = axis2_node_create();
+ if (!node)
+ {
+ fprintf(stderr, "%d Error", AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ comment = (axis2_om_comment_t *) malloc(sizeof(axis2_om_comment_t));
+ if (!comment)
+ {
+ free(node);
+ fprintf(stderr, "%d Error", AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ comment->value = strdup(value);
+ if (!comment->value)
+ {
+ fprintf(stderr, "%d Error", AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ }
+
+ node->data_element = comment;
+ node->element_type =AXIS2_OM_COMMENT;
+ return node;
+}
+
+
+void axis2_om_comment_free(axis2_om_comment_t * comment)
+{
+ if (comment)
+ {
+ if (comment->value)
+ {
+ free(comment->value);
+ }
+ free(comment);
+ }
+}
+
+char *axis2_om_comment_get_value(axis2_node_t * comment_node)
+{
+ if (!comment_node || comment_node->element_type !=AXIS2_OM_COMMENT)
+ {
+ return NULL;
+ }
+ return ((axis2_om_comment_t *) (comment_node->data_element))->value;
+}
+
+void axis2_om_comment_set_value(axis2_node_t * comment_node,
+ const char *value)
+{
+ axis2_om_comment_t *comment = NULL;
+
+ if (!comment_node || comment_node->element_type !=AXIS2_OM_COMMENT)
+ {
+ return;
+ }
+ comment = ((axis2_om_comment_t *) (comment_node->data_element));
+
+ if (comment->value)
+ {
+ free(comment->value);
+ }
+ comment->value = strdup(value);
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,113 @@
+/*
+ * 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_doctype.h>
+#include <stdlib.h>
+#include <axis2_errno.h>
+
+axis2_node_t *axis2_create_om_doctype(axis2_node_t * parent,const char *value)
+{
+ axis2_om_doctype_t *doctype = NULL;
+ axis2_node_t *node = axis2_node_create();
+ if (!node)
+ {
+ return NULL;
+ }
+ doctype = (axis2_om_doctype_t *) malloc(sizeof(axis2_om_doctype_t));
+ if (!doctype)
+ {
+ fprintf(stderr,"%d Error",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ free(node);
+ return NULL;
+ }
+ doctype->value = strdup(value);
+
+ node->data_element = doctype;
+
+ node->element_type = AXIS2_OM_DOCTYPE;
+
+ if (parent)
+ {
+ node->parent = parent;
+ axis2_node_add_child(parent, node);
+ }
+ return node;
+}
+
+axis2_node_t *axis2_om_doctype_create_empty_doctype(axis2_node_t * parent)
+{
+ axis2_node_t *node = NULL;
+ axis2_om_doctype_t *doctype = NULL;
+ if (!node)
+ {
+ return NULL;
+ }
+
+ doctype = (axis2_om_doctype_t *) malloc(sizeof(axis2_om_doctype_t));
+
+ if (!doctype)
+ {
+ free(node);
+ return NULL;
+ }
+
+ doctype->value = NULL;
+ node->data_element = doctype;
+ node->element_type =AXIS2_OM_DOCTYPE;
+
+ if (parent)
+ {
+ node->parent = parent;
+ axis2_node_add_child(parent, node);
+ }
+ return node;
+}
+
+void axis2_free_om_doctype(axis2_om_doctype_t * om_doc)
+{
+ if (om_doc)
+ {
+ if (om_doc->value)
+ {
+ free(om_doc->value);
+ }
+ free(om_doc);
+ }
+}
+
+char *axis2_om_doctype_get_value(axis2_node_t * doctype_node)
+{
+ if (!doctype_node || doctype_node->element_type !=AXIS2_OM_DOCTYPE)
+ {
+ return NULL;
+ }
+ return ((axis2_om_doctype_t *) (doctype_node->data_element))->value;
+}
+
+void axis2_om_doctype_set_value(axis2_node_t * doctype_node,const char *value)
+{
+ axis2_om_doctype_t *doctype = NULL;
+ if (!doctype_node || doctype_node->element_type !=AXIS2_OM_DOCTYPE)
+ {
+ return;
+ }
+ doctype = (axis2_om_doctype_t *) (doctype_node->data_element);
+ if (doctype->value)
+ {
+ free(doctype->value);
+ }
+ doctype->value = strdup(value);
+}
Added: 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=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_document.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,108 @@
+/*
+ * 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_errno.h>
+
+axis2_om_document_t *axis2_om_document_create(axis2_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_OM_MEMORY_ALLOCATION);
+ 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;
+ 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_node_t * child)
+{
+ if (!document || !child)
+ { /* nothing to do */
+ return;
+ }
+ if (document->first_child == NULL)
+ {
+ document->first_child = child;
+ child->prev_sibling = NULL;
+ }
+ else
+ {
+ child->prev_sibling = document->last_child;
+ document->last_child->next_sibling = child;
+ }
+ child->next_sibling = NULL;
+}
+
+
+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)
+{
+ axis2_stax_om_builder_next(document->builder);
+}
Added: 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=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_element.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,419 @@
+/*
+ * 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_errno.h>
+#include <axis2_om_element.h>
+#include <axis2_om_attribute.h>
+#include <axis2_om_namespace.h>
+#include <stdlib.h>
+
+static apr_pool_t *om_pool;
+
+axis2_node_t *axis2_om_element_create(const char *localname,axis2_om_namespace_t * ns
+ ,axis2_node_t *parent)
+{
+ axis2_node_t *node;
+ axis2_om_element_t *element;
+ if(!localname)
+ {
+ fprintf(stderr,"Localname can't be null");
+ return NULL;
+ }
+
+ node = axis2_node_create();
+ if (!node)
+ {
+ fprintf(stderr,"%d Error",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ element = (axis2_om_element_t *) malloc(sizeof(axis2_om_element_t));
+
+ if(!element)
+ {
+ axis2_node_free(node);
+ return NULL;
+ }
+ element->ns = NULL;
+ element->localname = strdup(localname);
+ element->pns_counter = 0;
+ element->attributes = NULL;
+ element->namespaces = NULL;
+
+ if(parent)
+ {
+ node->parent = parent;
+ axis2_node_add_child(parent,node);
+ }
+ node->done = true;
+ node->element_type = AXIS2_OM_ELEMENT;
+ node->data_element = element;
+ axis2_om_element_set_namespace(node,ns);
+
+ return node;
+
+}
+
+
+/* create an om_element using qname and parent */
+axis2_node_t *axis2_om_element_create_with_qname(axis2_qname_t *qname
+ ,axis2_node_t *parent)
+{
+ axis2_node_t *node = NULL;;
+ if (!qname)
+ {
+ return NULL; /* can't create an element */
+ }
+ node = axis2_om_element_create(qname->localpart, NULL,parent);
+ if (node)
+ {
+ ((axis2_om_element_t *) (node->data_element))->ns =
+ axis2_om_element_handle_namespace_with_qname(node,qname);
+ }
+ return node;
+}
+
+axis2_node_t *axis2_om_element_create_with_builder(const char *localname,axis2_om_namespace_t *ns
+ ,axis2_node_t *parent,axis2_stax_om_builder_t *builder)
+{ axis2_node_t *node;
+ axis2_om_element_t *element;
+ if(!localname)
+ {
+ fprintf(stderr,"Localname can't be null");
+ return NULL;
+ }
+
+ node = axis2_node_create();
+ if (!node)
+ {
+ fprintf(stderr,"%d Error",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ element = (axis2_om_element_t *) malloc(sizeof(axis2_om_element_t));
+
+ if(!element)
+ {
+ axis2_node_free(node);
+ return NULL;
+ }
+ element->localname = strdup(localname);
+ element->attributes = NULL;
+ element->pns_counter = 0;
+ element->namespaces = NULL;
+ element->ns = NULL;
+
+ node->builder = builder;
+ node->data_element = element;
+ node->done = false;
+ node->element_type = AXIS2_OM_ELEMENT;
+
+ if(parent)
+ {
+ node->parent = parent;
+ axis2_node_add_child(parent,node);
+ }
+ axis2_om_element_set_namespace(node,ns);
+ return node;
+}
+
+axis2_om_namespace_t *axis2_om_element_find_namespace(axis2_node_t
+ *element_node,const char *uri,const char *prefix)
+{
+ axis2_om_namespace_t *ns = NULL;
+
+ if (!element_node)
+ {
+ return NULL;
+ }
+ if (!(element_node->data_element) || element_node->element_type !=AXIS2_OM_ELEMENT)
+ {
+ /* wrong element type or null node */
+ return NULL;
+ }
+
+ ns = axis2_om_element_find_declared_namespace(element_node, uri,prefix);
+ if (!ns)
+ {
+ return ns;
+ }
+ if ((element_node->parent != NULL) &&
+ (element_node->parent->element_type ==AXIS2_OM_ELEMENT))
+ {
+ axis2_om_element_find_namespace(element_node->parent, uri, prefix);
+ }
+ return NULL;
+}
+
+
+/* declare a namespace for this om element */
+
+axis2_om_namespace_t *axis2_om_element_declare_namespace(axis2_node_t *
+ element_node,axis2_om_namespace_t *ns)
+{
+ apr_status_t status;
+ axis2_om_element_t *element = NULL;
+ if (!element_node || !ns || !element_node->data_element
+ || element_node->element_type != AXIS2_OM_ELEMENT)
+ {
+ return NULL;
+ }
+
+ element = (axis2_om_element_t *) (element_node->data_element);
+
+ if (!element->namespaces)
+ {
+ if (!om_pool)
+ {
+ status = apr_pool_create(&om_pool, NULL);
+ }
+
+ element->namespaces = apr_hash_make(om_pool);
+ }
+
+ apr_hash_set(element->namespaces, ns->prefix, APR_HASH_KEY_STRING, ns);
+
+ return ns;
+}
+
+
+axis2_om_namespace_t *axis2_om_element_declare_namespace_with_ns_uri_prefix(
+ axis2_node_t *element_node,const char *uri,const char *prefix)
+{
+ axis2_om_namespace_t *nsp = NULL;
+ nsp = axis2_om_namespace_create(uri, prefix);
+ if (nsp)
+ {
+ return axis2_om_element_declare_namespace(element_node, nsp);
+ }
+ return NULL;
+}
+
+/*
+* checks for the namespace in the current om element
+* can be used to retrive a prefix of a known namespace uri
+*
+*/
+axis2_om_namespace_t *axis2_om_element_find_declared_namespace(
+ axis2_node_t *element_node,const char *uri,const char *prefix)
+{
+ void *ns = NULL;
+ apr_hash_index_t *hashindex;
+ axis2_om_element_t *element = NULL;
+
+ if (!element_node || !ns || element_node->element_type != AXIS2_OM_ELEMENT)
+ {
+ return NULL;
+ }
+
+ element = (axis2_om_element_t *) (element_node->data_element);
+ if (!prefix || strcmp(prefix, "") == 0)
+ {
+ for(hashindex = apr_hash_first(om_pool,element->namespaces);
+ hashindex;hashindex = apr_hash_next(hashindex))
+ {
+ apr_hash_this(hashindex,NULL,NULL,&ns);
+ if(strcmp(((axis2_om_namespace_t*)(ns))->uri,uri))
+ {
+ return (axis2_om_namespace_t*)(ns);
+ }
+ }
+ }
+ ns = apr_hash_get(element->namespaces, prefix, APR_HASH_KEY_STRING);
+ return (axis2_om_namespace_t *) ns;
+}
+
+/*
+* This will find a namespace with the given uri and prefix, in the scope of the docuemnt.
+* This will start to find from the current element and goes up in the hiararchy until this finds one.
+*
+*/
+
+
+
+static axis2_om_namespace_t *axis2_om_element_handle_namespace_with_qname(
+ axis2_node_t *element_node,axis2_qname_t * qname)
+{
+ axis2_om_namespace_t *pns = NULL;
+ char *ns_uri = qname->ns_uri;
+ if (ns_uri != NULL)
+ {
+ pns = axis2_om_element_find_namespace(element_node, ns_uri,qname->prefix);
+ /**
+ * What is left now is
+ * 1. nsURI = null & parent != null, but ns = null
+ * 2. nsURI != null, (parent doesn't have an ns with given URI), but ns = null
+ */
+ if (pns == NULL)
+ {
+ if (qname->prefix)
+ {
+ pns = axis2_om_element_declare_namespace_with_ns_uri_prefix(
+ element_node, ns_uri, qname->prefix);
+ }
+ }
+ }
+ return NULL;
+}
+
+static axis2_om_namespace_t *axis2_om_element_handle_namespace(axis2_node_t
+ *element_node,axis2_om_namespace_t *ns)
+{
+ axis2_om_namespace_t *ns1 = NULL;
+ if (!ns || !element_node)
+ {
+ return NULL;
+ }
+ ns1 = axis2_om_element_find_namespace(element_node,ns->uri,ns->prefix);
+
+ if(!ns1)
+ {
+ ns1 = axis2_om_element_declare_namespace(element_node,ns);
+ }
+ return ns1;
+}
+
+
+axis2_om_attribute_t *axis2_om_element_add_attribute(axis2_node_t *element_node,
+ axis2_om_attribute_t *attr)
+{
+ apr_status_t status;
+ axis2_qname_t *qname = NULL;
+ axis2_om_element_t *element = NULL;
+
+ if (!element_node || element_node->element_type !=AXIS2_OM_ELEMENT)
+ {
+ return NULL;
+ }
+ element = (axis2_om_element_t *)(element_node->data_element);
+
+ if (!(element->attributes))
+ {
+ if (!om_pool)
+ {
+ status = apr_pool_create(&om_pool, NULL);
+ }
+ element->attributes = apr_hash_make(om_pool);
+ }
+
+ qname = axis2_om_attribute_get_qname(attr);
+
+ apr_hash_set(element->attributes, qname,sizeof(axis2_qname_t), attr);
+
+ return attr;
+}
+
+axis2_om_attribute_t *axis2_om_element_get_attribute(axis2_node_t *element_node,
+ axis2_qname_t *qname)
+{
+ char *key = NULL;
+ axis2_om_element_t *element = NULL;
+ if (!element_node || !qname
+ || element_node->element_type != AXIS2_OM_ELEMENT)
+ {
+ return NULL;
+ }
+ element = (axis2_om_element_t *) (element_node->data_element);
+
+ return (axis2_om_attribute_t *) (apr_hash_get(element->attributes, qname
+ ,sizeof(axis2_qname_t)));
+}
+
+/*
+* The node passed to the method should have the data element as of type OM_ELEMENT
+*/
+
+axis2_om_attribute_t *axis2_om_element_add_attribute_with_namespace(
+ axis2_node_t *element_node,const char *attribute_name,const char *value,
+ axis2_om_namespace_t *ns)
+{
+ axis2_om_namespace_t *namespace1= NULL;
+ if (!element_node || element_node->element_type != AXIS2_OM_ELEMENT)
+ {
+ return NULL;
+ }
+ if (ns)
+ {
+ namespace1 = axis2_om_element_find_namespace(element_node, ns->uri,
+ ns->prefix);
+ if (namespace1 == NULL)
+ {
+ return NULL;
+ }
+ }
+ return axis2_om_element_add_attribute(element_node,
+ axis2_om_attribute_create(attribute_name, value, ns));
+}
+
+
+void axis2_om_element_set_namespace(axis2_node_t * node,axis2_om_namespace_t *ns)
+{
+ axis2_om_namespace_t *nsp = NULL;
+ if (ns && node && (node->data_element))
+ {
+ nsp = axis2_om_element_handle_namespace(node, ns);
+ }
+ ((axis2_om_element_t *)( node->data_element))->ns = nsp;
+ nsp = NULL;
+}
+
+
+void axis2_free_om_element(axis2_om_element_t * element)
+{
+ if (element)
+ {
+ if (element->localname)
+ {
+ free(element->localname);
+ }
+ if (element->ns)
+ {
+ axis2_om_namespace_free(element->ns);
+ }
+ if (element->attributes)
+ {
+
+ }
+ if (element->namespaces)
+ {
+
+ }
+ free(element);
+ }
+}
+
+void axis2_om_element_set_localname(axis2_node_t * element_node,const char *localname)
+{
+ axis2_om_element_t *element = NULL;
+ if (!element_node || element_node->element_type !=AXIS2_OM_ELEMENT)
+ {
+ return;
+ }
+ element = (axis2_om_element_t *) (element_node->data_element);
+
+ if (element->localname)
+ {
+ free(element->localname);
+ }
+ element->localname = strdup(localname);
+}
+
+char *axis2_om_element_get_localname(axis2_node_t * element_node)
+{
+ if (!element_node || element_node->element_type !=AXIS2_OM_ELEMENT)
+ {
+ return NULL;
+ }
+ return ((axis2_om_element_t *) (element_node->data_element))->localname;
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,81 @@
+/*
+ * 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_namespace.h>
+#include <string.h>
+#include <stdlib.h>
+#include <axis2.h>
+
+
+
+axis2_om_namespace_t *axis2_om_namespace_create(const char *uri,
+ const char *prefix)
+{
+ axis2_om_namespace_t *ns = (axis2_om_namespace_t *) malloc(
+ sizeof(axis2_om_namespace_t));
+ if (!ns)
+ {
+ return NULL;
+ }
+ ns->uri = strdup(uri);
+ ns->prefix = strdup(prefix);
+ if(!(ns->prefix) || !(ns->uri))
+ {
+ free(ns);
+ return NULL;
+ }
+ return ns;
+}
+
+
+
+void axis2_om_namespace_free(axis2_om_namespace_t * ns)
+{
+ if (ns)
+ {
+ if(ns->prefix)
+ {
+ free(ns->prefix);
+ }
+ if(ns->uri)
+ {
+ free(ns->uri);
+ }
+ free(ns);
+ }
+}
+
+boolean_t axis2_om_namespace_equals(axis2_om_namespace_t * ns1,
+ axis2_om_namespace_t * ns2)
+{
+ int uris_differ = 0;
+ int prefixes_differ = 0;
+
+ if (!ns1 || !ns2)
+ return 0;
+
+ if (ns1->uri && ns2->uri)
+ uris_differ = strcmp(ns1->uri, ns2->uri);
+ else
+ uris_differ = (ns1->uri || ns2->uri);
+
+ if (ns1->prefix && ns2->prefix)
+ prefixes_differ = strcmp(ns1->prefix, ns2->prefix);
+ else
+ prefixes_differ = (ns1->prefix || ns2->prefix);
+
+ return (!uris_differ && !prefixes_differ);
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,145 @@
+/*
+ * 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_processing_instruction.h>
+#include <axis2_node.h>
+#include <stdlib.h>
+#include <axis2_errno.h>
+
+/**
+* allocate memory for processing instruction structure and assign the values;
+* This structure is set to axis2_node_t structure and returned.
+*
+*/
+
+axis2_node_t *axis2_create_om_processing_instruction_with_parent(
+ axis2_node_t *parent,const char *target,const char *value)
+{
+ axis2_om_processing_instruction_t *pi = NULL;
+ axis2_node_t *pi_node = axis2_node_create();
+
+ if (pi_node)
+ {
+ pi = (axis2_om_processing_instruction_t *)malloc(
+ sizeof(axis2_om_processing_instruction_t));
+ if (!pi)
+ {
+ free(pi_node);
+ fprintf(stderr, "%d error", AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ if(target)
+ {
+ pi->target = strdup(target);
+ }
+ if(value)
+ {
+ pi->value = strdup(value);
+ }
+ }
+
+ pi_node->data_element = pi;
+ pi_node->element_type =AXIS2_OM_PROCESSING_INSTRUCTION;
+
+ if (parent)
+ {
+ pi_node->parent = parent;
+ axis2_node_add_child(parent, pi_node);
+ }
+ return pi_node;
+}
+
+axis2_node_t *axis2_create_empty_om_processing_instruction(axis2_node_t *parent)
+{
+ axis2_node_t *pi_node = NULL;
+ axis2_om_processing_instruction_t *pi = NULL;
+ pi_node = axis2_node_create();
+ if (pi_node)
+ {
+ pi = (axis2_om_processing_instruction_t *)malloc(
+ sizeof(axis2_om_processing_instruction_t));
+ if (!pi)
+ {
+ free(pi_node);
+ return NULL;
+ }
+ pi->target = NULL;
+ pi->value = NULL;
+ }
+
+ pi_node->data_element = pi;
+ pi_node->element_type =AXIS2_OM_PROCESSING_INSTRUCTION;
+ if (parent)
+ {
+ pi_node->parent = parent;
+ axis2_node_add_child(parent, pi_node);
+ }
+ return pi_node;
+}
+
+
+char *axis2_om_processing_instruction_get_value(axis2_node_t * pi_node)
+{
+ if (!pi_node || pi_node->element_type !=AXIS2_OM_PROCESSING_INSTRUCTION)
+ {
+ return NULL;
+ }
+ return ((axis2_om_processing_instruction_t *)(pi_node->data_element))->value;
+}
+
+char *axis2_om_processing_instruction_get_target(axis2_node_t * pi_node)
+{
+ if (!pi_node || pi_node->element_type !=AXIS2_OM_PROCESSING_INSTRUCTION)
+ {
+ return NULL;
+ }
+ return ((axis2_om_processing_instruction_t *)(pi_node->data_element))->target;
+}
+
+void axis2_om_processing_instruction_set_value(axis2_node_t * pi_node,
+ const char *value)
+{
+ axis2_om_processing_instruction_t *pi = NULL;
+ if (!pi_node || pi_node->element_type !=AXIS2_OM_PROCESSING_INSTRUCTION)
+ {
+ return;
+ }
+ pi = ((axis2_om_processing_instruction_t *)(pi_node->data_element));
+ if (pi->value)
+ {
+ free(pi->value);
+ }
+ pi->value = strdup(value);
+ pi = NULL;
+}
+
+void axis2_om_processing_instruction_set_target(axis2_node_t * pi_node,
+ const char *value)
+{
+ axis2_om_processing_instruction_t *pi = NULL;
+ if (!pi_node || pi_node->element_type != AXIS2_OM_PROCESSING_INSTRUCTION)
+ {
+ return;
+ }
+ pi = (axis2_om_processing_instruction_t *) (pi_node->data_element);
+ if (pi->target)
+ {
+ free(pi->target);
+ }
+ pi->target = strdup(value);
+ pi = NULL;
+ return;
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,71 @@
+/*
+ * 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_text.h>
+#include <string.h>
+#include <axis2_node.h>
+#include <axis2_errno.h>
+
+axis2_node_t *axis2_create_om_text(axis2_node_t *parent,const char *value)
+{
+ axis2_om_text_t *text;
+ axis2_node_t *node = axis2_node_create();
+ if (!node)
+ {
+ fprintf(stderr,"%d Error",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ text = (axis2_om_text_t *) malloc(sizeof(axis2_om_text_t));
+ if (!text)
+ {
+ fprintf(stderr,"%d Error",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ text->value = strdup(value);
+ text->attribute = NULL;
+ text->content_id = NULL;
+ text->mime_type = NULL;
+ node->data_element = text;
+ node->element_type = AXIS2_OM_TEXT;
+
+ if(parent && parent->element_type == AXIS2_OM_ELEMENT)
+ {
+ node->done = true;
+ node->parent = parent;
+ axis2_node_add_child(parent,node);
+ }
+ return node;
+}
+
+
+
+char *axis2_om_text_get_text(axis2_om_text_t * text)
+{
+ if (!text)
+ {
+ return NULL;
+ }
+ if (text->value)
+ {
+ return text->value;
+ }
+ else
+ {
+ //MTOM handling logic should go hear
+
+ }
+ return NULL;
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_qname.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_qname.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_qname.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_qname.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,96 @@
+/*
+ * 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_qname.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <axis2_errno.h>
+
+axis2_qname_t *axis2_qname_create(const char *localname,
+ const char *ns_uri, const char *prefix)
+{
+ axis2_qname_t *qn = (axis2_qname_t *) malloc(sizeof(axis2_qname_t));
+ if (!qn)
+ {
+ fprintf(stderr," %d Error ",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ if(localname)
+ {
+ qn->localpart = strdup(localname);
+ }
+ if(ns_uri)
+ {
+ qn->ns_uri = strdup(ns_uri);
+ }
+ if(prefix)
+ {
+ qn->prefix = strdup(prefix);
+ }
+ return qn;
+}
+
+void axis2_free_qname(axis2_qname_t * qn)
+{
+ if (qn)
+ {
+ if(qn->localpart)
+ {
+ free(qn->localpart);
+ }
+ if(qn->ns_uri)
+ {
+ free(qn->ns_uri);
+ }
+ if(qn->prefix)
+ {
+ free(qn->prefix);
+ }
+ free(qn);
+ }
+}
+
+boolean_t axis2_qname_equals(axis2_qname_t *qn1,axis2_qname_t *qn2)
+{
+ int uris_differ = 0;
+ int localparts_differ = 0;
+
+ if(!qn1 && !qn2)
+ {
+ if( qn1 == qn2)
+ {
+ return true;
+ }
+ }
+ if(qn1->localpart && qn2->localpart)
+ {
+ localparts_differ = strcmp(qn1->localpart , qn2->localpart);
+ }
+ else
+ {
+ localparts_differ = (!(qn1->localpart) || !(qn2->localpart));
+ }
+ if( qn1->ns_uri && qn2->ns_uri )
+ {
+ uris_differ = strcmp( qn1->ns_uri , qn2->ns_uri );
+ }
+ else
+ {
+ uris_differ = (!(qn1->ns_uri) || !(qn2->ns_uri));
+ }
+ return (!uris_differ && !localparts_differ);
+}
Added: webservices/axis2/trunk/c/modules/xml/om/src/axis2_stax_ombuilder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_stax_ombuilder.c?rev=293264&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_stax_ombuilder.c (added)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_stax_ombuilder.c Sun Oct 2 23:29:50 2005
@@ -0,0 +1,247 @@
+/*
+ * 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_stax_ombuilder.h>
+#include <axis2_node.h>
+#include <stdlib.h>
+#include <namespace.h>
+#include <axis2_om_element.h>
+#include <axis2_errno.h>
+#include <xmlpullparser.h>
+
+axis2_stax_om_builder_t *create_stax_om_builder(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));
+ if(!builder)
+ {
+ fprintf(stderr," %d Error ",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ builder->parser = parser;
+ builder->cache = true;
+ builder->parser_accessed = false;
+ builder->done = false;
+ builder->lastnode=NULL;
+
+ document = axis2_om_document_create(NULL,builder);
+ if(document)
+ {
+ builder->document = document;
+ }
+ return builder;
+}
+
+axis2_node_t *axis2_stax_om_builder_create_om_element(
+ axis2_stax_om_builder_t *builder)
+{
+ axis2_node_t *element_node;
+ char *localname = XML_PullParser_getName(builder->parser);
+
+ if(!(builder->lastnode))
+ { /* */
+ element_node = axis2_om_element_create_with_builder(localname,NULL,NULL,builder);
+ builder->document->root_element = element_node;
+ axis2_om_document_add_child(builder->document,element_node);
+ }
+ else if(builder->lastnode->done)
+ { /* */
+ element_node = axis2_om_element_create_with_builder(localname,NULL,
+ builder->lastnode->parent,builder);
+ builder->lastnode->next_sibling = element_node;
+ element_node->prev_sibling = builder->lastnode;
+ }
+ else
+ { /* */
+ element_node = axis2_om_element_create_with_builder(localname,NULL,builder->lastnode,builder);
+ builder->lastnode->first_child = element_node;
+ element_node->parent = builder->lastnode;
+ }
+
+ // process namespace data
+ // process attributes
+
+return NULL;
+}
+
+axis2_node_t *axis2_stax_om_builder_create_om_comment(
+ axis2_stax_om_builder_t *builder)
+{
+ axis2_node_t *node;
+ if(!builder)
+ {
+ return NULL;
+ }
+ /*****/
+ return NULL;
+}
+
+
+axis2_node_t *axis2_stax_om_builder_create_om_doctype(
+ axis2_stax_om_builder_t *builder)
+{
+ /******/
+}
+
+
+axis2_node_t *axis2_stax_om_builder_create_om_processing_instruction(
+ axis2_stax_om_builder_t *builder)
+{
+ /******/
+
+
+
+
+
+}
+
+void axis2_stax_om_builder_end_element(axis2_stax_om_builder_t *builder)
+{
+ axis2_node_t *parent;
+ if(builder->lastnode->done)
+ {
+ parent = builder->lastnode->parent;
+ parent->done = true;
+ builder->lastnode = parent;
+ }
+ else
+ {
+ builder->lastnode->done = true;
+ }
+}
+
+
+int axis2_stax_om_builder_next(axis2_stax_om_builder_t *builder)
+{
+ int token = 0;
+ if(builder->done)
+ {
+ fprintf(stderr,"%d Errpr",-1);
+ return NULL;
+ }
+
+ token = XML_PullParser_next (builder->parser);
+ if(!(builder->cache))
+ {
+ return token;
+ }
+
+
+ switch(token)
+ {
+ case START_DOCUMENT:
+ {
+
+ }
+ break;
+
+ case START_ELEMENT:
+ {
+ builder->lastnode = axis2_stax_om_builder_create_om_element(builder);
+ }
+ break;
+ case END_ELEMENT:
+ {
+
+
+
+
+ }
+ break;
+ case CHARACTER:
+ {
+
+
+
+
+ }
+ break;
+ case COMMENT:
+ {
+
+
+
+
+
+
+ }
+ break;
+ };
+}
+
+
+void axis2_stax_om_builder_process_attributes(axis2_stax_om_builder_t *builder,axis2_node_t *element_node)
+{
+}
+
+
+axis2_node_t *axis2_stax_om_builder_create_om_text(axis2_stax_om_builder_t *builder)
+{
+}
+
+
+void axis2_stax_om_builder_discard(axis2_stax_om_builder_t *builder,axis2_node_t *element_node)
+{
+
+}
+
+
+axis2_node_t *axis2_stax_om_builder_process_namespace_data(axis2_stax_om_builder_t *builder,axis2_node_t *element,int is_soap_element)
+{
+ int i=0;
+ char *nsuri = NULL;
+ char *prefix = NULL;
+ NAMESPACE *NS;
+ axis2_om_namespace_t *ns,*ns1;
+ int namespace_count = XML_PullParser_getNamespaceCount (builder->parser);
+ for( i = 0 ; i < namespace_count ; i++)
+ {
+ axis2_om_element_declare_namespace_with_ns_uri_prefix(element,XML_PullParser_getNamespaceUri_by_number(builder->parser,i),XML_PullParser_getNamespacePrefix_by_number(builder->parser,i));
+ }
+ /* set own namespace */
+ NS = XML_PullParser_getNamespace(builder->parser);
+ nsuri =XML_PullParser_getNamespaceUri(builder->parser,NS);
+ prefix =XML_PullParser_getNamespacePrefix(builder->parser,NS);
+ if(strcmp(nsuri,"") != 0)
+ {
+ if(!prefix)
+ {
+
+ ns = axis2_om_element_find_namespace(element,nsuri,"");
+ if(!ns)
+ {
+ ns = axis2_om_element_declare_namespace_with_ns_uri_prefix(element,nsuri,"");
+ }
+ if(((axis2_om_element_t*)element)->ns == ns)
+ {
+ axis2_om_element_set_namespace(element,ns);
+ }
+ }
+ else
+ {
+ ns = axis2_om_element_find_namespace(element,nsuri,prefix);
+ if(!ns)
+ {
+ ns1 = axis2_om_namespace_create(nsuri,prefix);
+ axis2_om_element_set_namespace(element,ns);
+ }
+ else
+ {
+ axis2_om_element_set_namespace(element,ns);
+ }
+ }
+ }
+}
Modified: webservices/axis2/trunk/c/modules/xml/om/test/om_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/test/om_test.c?rev=293264&r1=293263&r2=293264&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/test/om_test.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/test/om_test.c Sun Oct 2 23:29:50 2005
@@ -1,46 +1,47 @@
+#include <CuTest.h>
+#include <string.h>
#include <stdio.h>
-#include <axis2c_om_element.h>
-#include <axis2c_om_namespace.h>
-#include <axis2c_node.h>
-#include <apr.h>
+#include <axis2_node.h>
-/**
- * This code shows how the currently implemented code support building of om tree programmtically
- *
- */
+void Testnode_detach(CuTest *tc) {
+ axis2_node_t* parent = axis2_node_create();
+ axis2_node_t* prev_sibling = axis2_node_create();
+ axis2_node_add_child(parent, prev_sibling);
+ axis2_node_t* test_node = axis2_node_create();
+ axis2_node_add_child(parent, test_node);
+ axis2_node_t* next_sibling = axis2_node_create();
+ axis2_node_add_child(parent, next_sibling);
+
+ axis2_node_t* temp_parent = axis2_node_detach(test_node);
+ puts("came");
+ if(0 == temp_parent) puts("parent is null\n");
+ axis2_node_t* expected = temp_parent->first_child;
+ printf("came2");
+ if(0 == expected) puts("expected is null\n");
+ axis2_node_t* actual = next_sibling;
+
+ CuAssertPtrEquals(tc, expected, actual);
+}
+
+CuSuite* node_detachGetSuite() {
+ CuSuite* suite = CuSuiteNew();
+ SUITE_ADD_TEST(suite, Testnode_detach);
+ return suite;
+}
+
+ void RunAllTests(void) {
+ CuString *output = CuStringNew();
+ CuSuite* suite = CuSuiteNew();
+
+ CuSuiteAddSuite(suite, node_detachGetSuite());
+
+ CuSuiteRun(suite);
+ CuSuiteSummary(suite, output);
+ CuSuiteDetails(suite, output);
+ printf("%s\n", output->buffer);
+}
-
-
-
-
-int main()
-{
- axis2c_om_attribute_t *attr1;
- axis2c_om_namespace_t *ns1;
- axis2c_node_t *root,*ele1,*ele2;
-
- if(apr_initialize()!= APR_SUCCESS)
- {
- return -1;
- }
-
-
- ns1 = axis2c_create_om_namespace("ns1","test");
-
- root = axis2c_create_om_element("root",ns1);
- ele1 = axis2c_create_om_element_with_parent("ele1",ns1,root);
- ele2 = axis2c_create_om_element("ele2",ns1);
-
- axis2c_node_add_child(ele1,ele2);
-
- attr1 = axis2c_create_om_attribute("attribute1","x",ns1);
-
- axis2c_om_element_add_attribute(ele2,attr1);
-
-
- printf("%s",axis2c_om_element_get_localname(ele2->parent->parent));
-
- getchar();
-
+int main(void) {
+ RunAllTests();
return 0;
}