axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r326031 - in /webservices/axis2/trunk/c: include/ modules/xml/om/src/
Date Tue, 18 Oct 2005 05:01:53 GMT
Author: samisa
Date: Mon Oct 17 22:01:37 2005
New Revision: 326031

URL: http://svn.apache.org/viewcvs?rev=326031&view=rev
Log:
Some more changes related to envioronment related updates

Modified:
    webservices/axis2/trunk/c/include/axis2_om_doctype.h
    webservices/axis2/trunk/c/include/axis2_om_processing_instruction.h
    webservices/axis2/trunk/c/include/axis2_om_text.h
    webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am
    webservices/axis2/trunk/c/modules/xml/om/src/Makefile.in
    webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.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

Modified: webservices/axis2/trunk/c/include/axis2_om_doctype.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_doctype.h?rev=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_doctype.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_doctype.h Mon Oct 17 22:01:37 2005
@@ -24,8 +24,21 @@
 
 #include <axis2_om_node.h>
 
-typedef struct axis2_om_doctype_t
+struct axis2_om_doctype;
+struct axis2_om_doctype_ops;	
+
+typedef struct axis2_om_doctype_ops
+{
+	/**
+	 *	free the axis2_om_doctype_t struct
+	 *	param om_doc pointer to axis2_om_doctype_t struct
+	 */
+	axis2_status_t (*axis2_om_doctype_ops_free)(axis2_environment_t *environment, struct axis2_om_doctype
*om_doctype);
+} axis2_om_doctype_ops_t;
+
+typedef struct axis2_om_doctype
 {
+	axis2_om_doctype_ops_t* ops;
 	char *value;
 }axis2_om_doctype_t;
 
@@ -40,36 +53,9 @@
 
 
 
-axis2_om_doctype_t *axis2_om_doctype_create(axis2_om_node_t *parent,const char *value,axis2_om_node_t
*doctype_node);
-
-
-/**
- *	create an axis2_om_doctype_t struct with parent 
- *  value field will be set to null
- *  return poniter to a axis2_om_node_t 
- */
-
-
-axis2_om_doctype_t *axis2_om_doctype_create_empty_doctype(axis2_om_node_t *parent,axis2_om_node_t
*doctype_node);
-
-/**
- *	free the axis2_om_doctype_t struct
- *	param om_doc pointer to axis2_om_doctype_t struct
- */
-void axis2_om_doctype_free(axis2_om_doctype_t *om_doc);
+axis2_om_doctype_t *axis2_om_doctype_create(axis2_environment_t *environment, axis2_om_node_t
*parent, const axis2_char_t *value, axis2_om_node_t **node);
 
-/**
- *	accessor function to get value of doctype
- *	param om_doc pointer to axis2_om_doctype_t struct
- */
-char *om_doctype_get_value(axis2_om_node_t *doctype_node);
+#define axis2_om_doctype_free(environment, doctype) ((doctype)->ops->axis2_om_doctype_ops_free(environment,
doctype))
 
-/**
- *	mutator function to get value of doctype
- *	param om_doc pointer to axis2_om_doctype_t struct
- *  param value value to be set in om_doctype
- */
- 
-void om_doctype_set_value(axis2_om_node_t *doctype_node,const char *value);
 
-#endif				//  AXIS2_OM_DOCTYPE_H
+#endif				/* AXIS2_OM_DOCTYPE_H */

Modified: webservices/axis2/trunk/c/include/axis2_om_processing_instruction.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_processing_instruction.h?rev=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_processing_instruction.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_processing_instruction.h Mon Oct 17 22:01:37
2005
@@ -24,9 +24,18 @@
 
 #include <axis2_om_node.h>
 
-typedef struct axis2_om_processing_instruction_t {
-    char *target;
-    char *value;
+struct axis2_om_processing_instruction;
+struct axis2_om_processing_instruction_ops;
+
+typedef struct axis2_om_processing_instruction_ops
+{
+	axis2_status_t (*axis2_om_processing_instruction_ops_free)(axis2_environment_t *environment,
struct axis2_om_processing_instruction *om_pi);
+} axis2_om_processing_instruction_ops_t;
+
+typedef struct axis2_om_processing_instruction {
+	axis2_om_processing_instruction_ops_t *ops;
+    axis2_char_t *target;
+    axis2_char_t *value;
 } axis2_om_processing_instruction_t;
 
 /**
@@ -34,22 +43,6 @@
  *	@return a pointer to axis2_om_node_t struct containing PI
  */ 
 
-axis2_om_processing_instruction_t *axis2_om_processing_instruction_create(axis2_om_node_t
*parent,const char *target,const char *value,axis2_om_node_t *node);
-/**
- *  creates empty axis2_om_processing_instruction and 
- *	@return a pointer to axis2_om_node_t struct containing PI
- */
-
-axis2_om_processing_instruction_t *axis2_om_processing_instruction_create_empty(axis2_om_node_t
*parent,axis2_om_node_t *node);
-
-
-
-void axis2_om_processing_instruction_serialize_with_cache(FILE *output_stream);
-/**
- *
- *
- */
-
-void axis2_om_processing_instruction_discard(axis2_om_processing_instruction_t *om_pi);
+axis2_om_processing_instruction_t *axis2_om_processing_instruction_create(axis2_environment_t
*environment, axis2_om_node_t *parent,const axis2_char_t *target,const axis2_char_t *value,axis2_om_node_t
**node);
 
-#endif				// AXIS2_OM_PI_H
+#endif				/* AXIS2_OM_PI_H */

Modified: webservices/axis2/trunk/c/include/axis2_om_text.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_text.h?rev=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_text.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_text.h Mon Oct 17 22:01:37 2005
@@ -58,14 +58,14 @@
 	* Free an axis2_om_text_t structure
     * @return Status code
     */
-    int (*free)(axis2_environment_t *environment, struct axis2_om_text *om_text);
+    axis2_status_t (*axis2_om_text_ops_free)(axis2_environment_t *environment, struct axis2_om_text
*om_text);
     
   /**
     * Serialize operation
     * @param om_output OM output handler to be used in serializing
     * @return Status code
     */
-    int (*serialize)(axis2_environment_t *environment, const struct axis2_om_text *om_text,
axis2_om_output_t* om_output);
+    axis2_status_t (*axis2_om_text_ops_serialize)(axis2_environment_t *environment, const
struct axis2_om_text *om_text, axis2_om_output_t* om_output);
 } axis2_om_text_ops_t;
     
 /** \struct axis2_om_text
@@ -111,8 +111,8 @@
 axis2_om_text_t *axis2_om_text_create(axis2_environment_t *environment, axis2_om_node_t *parent,const
axis2_char_t *value
 						,axis2_om_node_t **node);
 
-#define axis2_om_text_serialize(environment, om_text, om_output) ((om_text)->ops->serialize(environment,
om_text, om_output))
-#define axis2_om_text_free(environment, om_text) ((om_text)->ops->free(environment,
om_text))
+#define axis2_om_text_serialize(environment, om_text, om_output) ((om_text)->ops->axis2_om_text_ops_serialize(environment,
om_text, om_output))
+#define axis2_om_text_free(environment, om_text) ((om_text)->ops->axis2_om_text_ops_free(environment,
om_text))
 
 /** @} */
 

Modified: webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am?rev=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am Mon Oct 17 22:01:37 2005
@@ -1,6 +1,6 @@
 lib_LTLIBRARIES = libom.la
 AM_CPPFLAGS = $(CPPFLAGS)
-libom_la_SOURCES = axis2_om_attribute.c axis2_om_document.c axis2_om_node.c axis2_om_text.c
axis2_om_comment.c axis2_om_element.c axis2_om_output.c axis2_qname.c axis2_om_doctype.c axis2_om_namespace.c
axis2_om_processing_instruction.c axis2_stax_ombuilder.c
+libom_la_SOURCES = axis2_om_attribute.c axis2_om_document.c axis2_om_node.c axis2_om_text.c
axis2_om_comment.c axis2_om_element.c axis2_om_output.c axis2_qname.c axis2_om_doctype.c axis2_om_namespace.c
axis2_om_processing_instruction.c axis2_om_stax_builder.c
 
 libom_la_LIBADD = $(LDFLAGS)
 INCLUDES = -I../../../../include -I../../guththila/src -I$(APR_HOME)/include/apr-1 -I${CUTEST_HOME}/include

Modified: webservices/axis2/trunk/c/modules/xml/om/src/Makefile.in
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/Makefile.in?rev=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/Makefile.in (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/Makefile.in Mon Oct 17 22:01:37 2005
@@ -67,7 +67,7 @@
 	axis2_om_node.lo axis2_om_text.lo axis2_om_comment.lo \
 	axis2_om_element.lo axis2_om_output.lo axis2_qname.lo \
 	axis2_om_doctype.lo axis2_om_namespace.lo \
-	axis2_om_processing_instruction.lo axis2_stax_ombuilder.lo
+	axis2_om_processing_instruction.lo axis2_om_stax_builder.lo
 libom_la_OBJECTS = $(am_libom_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
@@ -195,7 +195,7 @@
 target_vendor = @target_vendor@
 lib_LTLIBRARIES = libom.la
 AM_CPPFLAGS = $(CPPFLAGS)
-libom_la_SOURCES = axis2_om_attribute.c axis2_om_document.c axis2_om_node.c axis2_om_text.c
axis2_om_comment.c axis2_om_element.c axis2_om_output.c axis2_qname.c axis2_om_doctype.c axis2_om_namespace.c
axis2_om_processing_instruction.c axis2_stax_ombuilder.c
+libom_la_SOURCES = axis2_om_attribute.c axis2_om_document.c axis2_om_node.c axis2_om_text.c
axis2_om_comment.c axis2_om_element.c axis2_om_output.c axis2_qname.c axis2_om_doctype.c axis2_om_namespace.c
axis2_om_processing_instruction.c axis2_om_stax_builder.c
 libom_la_LIBADD = $(LDFLAGS)
 INCLUDES = -I../../../../include -I../../guththila/src -I$(APR_HOME)/include/apr-1 -I${CUTEST_HOME}/include
 all: all-am
@@ -276,9 +276,9 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_om_node.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_om_output.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_om_processing_instruction.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_om_stax_builder.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_om_text.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_qname.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/axis2_stax_ombuilder.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<;
\

Modified: 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=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_doctype.c Mon Oct 17 22:01:37 2005
@@ -15,102 +15,83 @@
  */
 
 #include <axis2_om_doctype.h>
-#include <stdlib.h>
-#include <axis2_errno.h>
 
+axis2_status_t axis2_om_doctype_impl_free(axis2_environment_t *environment, axis2_om_doctype_t
*doctype);
 
-axis2_om_doctype_t *axis2_om_doctype_create(axis2_om_node_t *parent , const char *value,
axis2_om_node_t *doc_node)
+axis2_om_doctype_t *axis2_om_doctype_create(axis2_environment_t *environment, axis2_om_node_t
*parent, const axis2_char_t *value, axis2_om_node_t **node)
 {
     axis2_om_doctype_t *doctype = NULL;
-    axis2_om_node_t *node = axis2_om_node_create();
+    
     if (!node)
     {
+        environment->error->errorno = AXIS2_ERROR_INVALID_NULL_PARAMETER;
+        return NULL;
+    }
+
+    *node = axis2_om_node_create(environment);
+    if (!*node)
+    {
+		environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
 		return NULL;
     }
-    doctype = (axis2_om_doctype_t *) malloc(sizeof(axis2_om_doctype_t));
+    
+    doctype = (axis2_om_doctype_t *) axis2_malloc(environment->allocator, sizeof(axis2_om_doctype_t));
     if (!doctype)
     {
-		fprintf(stderr,"%d Error",AXIS2_ERROR_OM_MEMORY_ALLOCATION);
-		free(node);
+		axis2_om_node_free(environment, *node);
+		environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
 		return NULL;
     }
-    doctype->value     = strdup(value);
-
-    node->data_element = doctype;
     
-	node->element_type = AXIS2_OM_DOCTYPE;
+    doctype->value = NULL;
     
-	if (parent)
+    if (value)
     {
-		node->parent = parent;
-		axis2_om_node_add_child(parent, node);
+        doctype->value = axis2_strdup(environment->string, value);
+        if (!doctype->value)
+        {
+            axis2_om_node_free(environment, *node);
+            axis2_free(environment->allocator, doctype);
+            environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+            return NULL;
+        }
     }
-	doc_node = node;
-    return doctype;
-}
 
-axis2_om_doctype_t *axis2_om_doctype_create_empty_doctype(axis2_om_node_t * parent,axis2_om_node_t
*doc_node)
-{
-    axis2_om_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)
+    (*node)->data_element = doctype;
+    (*node)->node_type = AXIS2_OM_DOCTYPE;
+	
+	if (parent)
     {
-		free(node);
-		return NULL;
+        (*node)->parent = parent;
+        axis2_om_node_add_child (environment, parent, (*node));
+    }
+	
+    /* operations */
+    doctype->ops = NULL;
+    doctype->ops = (axis2_om_doctype_ops_t*) axis2_malloc(environment->allocator, sizeof(axis2_om_doctype_ops_t));
+    if (!doctype->ops)
+    {
+        axis2_om_node_free(environment, *node);
+        axis2_free(environment->allocator, doctype);
+        axis2_free(environment->allocator, doctype->value);
+        environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+        return NULL;
     }
     
-	doctype->value = NULL;
-    node->data_element = doctype;
-    node->element_type =AXIS2_OM_DOCTYPE;
+    doctype->ops->axis2_om_doctype_ops_free = axis2_om_doctype_impl_free;
     
-	if (parent)
-    {
-		node->parent = parent;
-		axis2_om_node_add_child(parent, node);
-    }
-	doc_node = node;
     return doctype;
 }
 
-void axis2_free_om_doctype(axis2_om_doctype_t * om_doc)
+
+axis2_status_t axis2_om_doctype_impl_free(axis2_environment_t *environment, axis2_om_doctype_t
*doctype)
 {
-    if (om_doc)
+    if (doctype)
     {
-		if (om_doc->value)
+		if (doctype->value)
 		{
-	    	free(om_doc->value);
+	    	axis2_free(environment->allocator, doctype->value);
 		}
-		free(om_doc);
-    }
-}
-
-char *axis2_om_doctype_get_value(axis2_om_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_om_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);
+		axis2_free(environment->allocator, doctype);
     }
-    doctype->value = strdup(value);
 }

Modified: 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=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_namespace.c Mon Oct 17 22:01:37
2005
@@ -144,7 +144,7 @@
     }
     
     if (om_namespace->uri && om_namespace->prefix)
-        status = axis2_om_output_write (om_output, AXIS2_OM_NAMESPACE, 2,
+        status = axis2_om_output_write (environment, om_output, AXIS2_OM_NAMESPACE, 2,
                                         om_namespace->prefix, om_namespace->uri);
     return status;
 

Modified: 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=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_processing_instruction.c Mon Oct
17 22:01:37 2005
@@ -15,128 +15,104 @@
  */
  
 #include <axis2_om_processing_instruction.h>
-#include <axis2_om_node.h>
-#include <stdlib.h>
-#include <axis2_errno.h>
 
-axis2_om_processing_instruction_t *axis2_om_processing_instruction_create(axis2_om_node_t
*parent,const char *target,const char *value,axis2_om_node_t *pinode)
-{
-    axis2_om_processing_instruction_t *pi = NULL;
-    axis2_om_node_t *pi_node = axis2_om_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;
+axis2_status_t axis2_om_processing_instruction_impl_free(axis2_environment_t *environment,
axis2_om_processing_instruction_t *processing_instruction);
 
-    if (parent)
+axis2_om_processing_instruction_t *axis2_om_processing_instruction_create(axis2_environment_t
*environment, axis2_om_node_t *parent,const axis2_char_t *target,const axis2_char_t *value,
axis2_om_node_t **node)
+{
+    axis2_om_processing_instruction_t *processing_instruction = NULL;
+	
+	if (!node || !target || !value)
     {
-		pi_node->parent = parent;
-		axis2_om_node_add_child(parent, pi_node);
+        environment->error->errorno = AXIS2_ERROR_INVALID_NULL_PARAMETER;
+        return NULL;
     }
-	pinode = pi_node;
-	
-    return pi;
-}
 
-axis2_om_processing_instruction_t *axis2_om_processing_instruction_create_empty(axis2_om_node_t
*parent
-								,axis2_om_node_t *node)
-{
-    axis2_om_node_t *pi_node = NULL;
-    axis2_om_processing_instruction_t *pi = NULL;
-    pi_node = axis2_om_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;
+    *node = axis2_om_node_create(environment);
+    if (!*node)
+    {
+		environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+		return NULL;
     }
     
-	pi_node->data_element = pi;
-    pi_node->element_type =AXIS2_OM_PROCESSING_INSTRUCTION;
-    if (parent)
+    processing_instruction = (axis2_om_processing_instruction_t *) axis2_malloc(environment->allocator,
sizeof(axis2_om_processing_instruction_t));
+    if (!processing_instruction)
     {
-		pi_node->parent = parent;
-		axis2_om_node_add_child(parent, pi_node);
+		axis2_om_node_free(environment, *node);
+		environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+		return NULL;
     }
-	node = pi_node;
-    return pi;
-}
-
-
-char *axis2_om_processing_instruction_get_value(axis2_om_node_t * pi_node)
-{
-    if (!pi_node || pi_node->element_type !=AXIS2_OM_PROCESSING_INSTRUCTION)
+    
+    processing_instruction->value = NULL;
+    
+    if (value)
     {
-		return NULL;
+        processing_instruction->value = axis2_strdup(environment->string, value);
+        if (!processing_instruction->value)
+        {
+            axis2_free(environment->allocator, processing_instruction);
+			axis2_om_node_free(environment, *node);            
+            environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+            return NULL;
+        }
     }
-    return ((axis2_om_processing_instruction_t *)(pi_node->data_element))->value;
-}
-
-char *axis2_om_processing_instruction_get_target(axis2_om_node_t * pi_node)
-{
-    if (!pi_node || pi_node->element_type !=AXIS2_OM_PROCESSING_INSTRUCTION)
+	
+	processing_instruction->target = NULL;
+    
+    if (target)
     {
-	return NULL;
+        processing_instruction->target = axis2_strdup(environment->string, target);
+        if (!processing_instruction->target)
+        {
+			axis2_free(environment->allocator, processing_instruction->value);
+            axis2_free(environment->allocator, processing_instruction);
+			axis2_om_node_free(environment, *node);            
+            environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+            return NULL;
+        }
     }
-    return ((axis2_om_processing_instruction_t *)(pi_node->data_element))->target;
-}
 
-void axis2_om_processing_instruction_set_value(axis2_om_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)
+    (*node)->data_element = processing_instruction;
+    (*node)->node_type = AXIS2_OM_PROCESSING_INSTRUCTION;
+	
+	if (parent)
     {
-		return;
+        (*node)->parent = parent;
+        axis2_om_node_add_child (environment, parent, (*node));
     }
-    pi = ((axis2_om_processing_instruction_t *)(pi_node->data_element));
-    if (pi->value)
-    {
-		free(pi->value);
+	
+    /* operations */
+    processing_instruction->ops = NULL;
+    processing_instruction->ops = (axis2_om_processing_instruction_ops_t*) axis2_malloc(environment->allocator,
sizeof(axis2_om_processing_instruction_ops_t));
+    if (!processing_instruction->ops)
+    {
+        axis2_free(environment->allocator, processing_instruction->value);
+		axis2_free(environment->allocator, processing_instruction->target);
+		axis2_free(environment->allocator, processing_instruction);        
+		axis2_om_node_free(environment, *node);        
+        environment->error->errorno = AXIS2_ERROR_NO_MEMORY;
+        return NULL;
     }
-    pi->value = strdup(value);
-    pi = NULL;
+    
+    processing_instruction->ops->axis2_om_processing_instruction_ops_free = axis2_om_processing_instruction_impl_free;
+	
+    return processing_instruction;
 }
 
-void axis2_om_processing_instruction_set_target(axis2_om_node_t * pi_node,
-						 const char *value)
+axis2_status_t axis2_om_processing_instruction_impl_free(axis2_environment_t *environment,
axis2_om_processing_instruction_t *processing_instruction)
 {
-    axis2_om_processing_instruction_t *pi = NULL;
-    if (!pi_node || pi_node->element_type != AXIS2_OM_PROCESSING_INSTRUCTION)
+    if (processing_instruction)
     {
-		return;
-    }
-    pi = (axis2_om_processing_instruction_t *) (pi_node->data_element);
-    if (pi->target)
-    {
-		free(pi->target);
+		if (processing_instruction->value)
+		{
+	    	axis2_free(environment->allocator, processing_instruction->value);
+		}
+		
+		if (processing_instruction->target)
+		{
+	    	axis2_free(environment->allocator, processing_instruction->target);
+		}
+		
+		axis2_free(environment->allocator, processing_instruction);
     }
-    pi->target = strdup(value);
-    pi = NULL;
-    return;
 }

Modified: 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=326031&r1=326030&r2=326031&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_text.c Mon Oct 17 22:01:37 2005
@@ -22,8 +22,8 @@
 */
 
 /* operations */
-int axis2_om_text_ops_free(axis2_environment_t *environment, axis2_om_text_t *om_text);
-int axis2_om_text_ops_serialize(axis2_environment_t *environment, const axis2_om_text_t *om_text,
axis2_om_output_t* om_output);
+axis2_status_t axis2_om_text_impl_free(axis2_environment_t *environment, axis2_om_text_t
*om_text);
+axis2_status_t axis2_om_text_impl_serialize(axis2_environment_t *environment, const axis2_om_text_t
*om_text, axis2_om_output_t* om_output);
 
 axis2_om_text_t *axis2_om_text_create(axis2_environment_t *environment, axis2_om_node_t *parent,const
axis2_char_t *value
 						,axis2_om_node_t **node)
@@ -85,14 +85,14 @@
 		return NULL;
     }
     
-    om_text->ops->free = axis2_om_text_ops_free;
-    om_text->ops->serialize = axis2_om_text_ops_serialize;
+    om_text->ops->axis2_om_text_ops_free = axis2_om_text_impl_free;
+    om_text->ops->axis2_om_text_ops_serialize = axis2_om_text_impl_serialize;
 
     return om_text;
 }
 
 
-int axis2_om_text_ops_free(axis2_environment_t *environment, axis2_om_text_t *om_text)
+axis2_status_t axis2_om_text_impl_free(axis2_environment_t *environment, axis2_om_text_t
*om_text)
 {
     if (!om_text)
     {
@@ -112,7 +112,7 @@
     return AXIS2_SUCCESS;
 }
 
-int axis2_om_text_ops_serialize(axis2_environment_t *environment, const axis2_om_text_t *om_text,
axis2_om_output_t* om_output)
+axis2_status_t axis2_om_text_impl_serialize(axis2_environment_t *environment, const axis2_om_text_t
*om_text, axis2_om_output_t* om_output)
 {
     int status = AXIS2_SUCCESS;
 



Mime
View raw message