You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/10/03 07:21:33 UTC
svn commit: r293252 - in /webservices/axis2/trunk/c: ./ include/
modules/xml/om/ modules/xml/om/src/
Author: samisa
Date: Sun Oct 2 22:21:08 2005
New Revision: 293252
URL: http://svn.apache.org/viewcvs?rev=293252&view=rev
Log:
Changed om module. Added more to the builder code
Modified:
webservices/axis2/trunk/c/include/axis2c_node.h
webservices/axis2/trunk/c/include/axis2c_om_attribute.h
webservices/axis2/trunk/c/include/axis2c_om_comment.h
webservices/axis2/trunk/c/include/axis2c_om_doctype.h
webservices/axis2/trunk/c/include/axis2c_om_document.h
webservices/axis2/trunk/c/include/axis2c_om_element.h
webservices/axis2/trunk/c/include/axis2c_om_namespace.h
webservices/axis2/trunk/c/include/axis2c_om_processing_instruction.h
webservices/axis2/trunk/c/include/axis2c_om_text.h
webservices/axis2/trunk/c/include/axis2c_qname.h
webservices/axis2/trunk/c/include/axis2c_stax_ombuilder.h
webservices/axis2/trunk/c/modules/xml/om/project.properties
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_attribute.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_comment.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_doctype.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_document.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_element.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_namespace.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_processing_instruction.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_text.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_qname.c
webservices/axis2/trunk/c/modules/xml/om/src/axis2c_stax_ombuilder.c
webservices/axis2/trunk/c/project.properties
Modified: webservices/axis2/trunk/c/include/axis2c_node.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_node.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_node.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_node.h Sun Oct 2 22:21:08 2005
@@ -17,13 +17,20 @@
#ifndef AXIS2C_NODE_H
#define AXIS2C_NODE_H
+/**
+ * @file axis2c_node.h
+ * @brief defines node data structure, used for constructing the om tree and its
+ * manipulation functions
+ */
+
+
+#include <axis2c.h>
#include <apr.h>
#include <apr_pools.h>
#include <xmlpullparser.h>
-//static apr_pool_t *om_pool; // a memory pool to be used for this module
+typedef struct axis2c_stax_om_builder_s axis2c_stax_om_builder_t;
-typedef struct axis2c_stax_om_builder_s axis2c_stax_om_builder_t;
typedef enum axis2c_om_types_t {
AXIS2C_OM_INVALID = -1,
@@ -37,12 +44,17 @@
AXIS2C_OM_TEXT = 80
} axis2c_om_types_t;
-/*
+/**
* This is the structure that defines a node in om tree
-* parent - parent node if one is available
-* parser - carries a pointer to the XML_PullParser
-* element_type - the type of the element one of omtypes
-* data_element - stores the structs created for storing xml
+* @param parent - parent node if one is available
+* @param parser - carries a pointer to the XML_PullParser
+* @param element_type - the type of the element one of omtypes
+* @param data_element - stores the structs created for storing xml elements
+* e.g axis2c_om_element_t axis2c_om_text_t
+*
+* we keep pointers parent , previous sibling , next sibling ,
+* first child and last child for constructing and navigating the tree
+*
*/
typedef struct axis2c_node_t {
struct axis2c_node_t *parent;
@@ -52,36 +64,60 @@
struct axis2c_node_t *last_child;
axis2c_stax_om_builder_t *builder;
axis2c_om_types_t element_type;
- int done;
+ boolean_t done;
void* data_element;
} axis2c_node_t;
+/**
+ * Create a node struct.
+ * @return a node or NULL if there isn't enough memory
+ */
+
+axis2c_node_t *axis2c_node_create();
+
+/**
+ * destroy the node .
+ * @param node to free
+ */
+void axis2c_node_free(axis2c_node_t *node);
+
+/**
+ * adds a child node to this node .
+ * @param parent parent node
+ * @param child child node
+ */
-//create a node and allocate memory
-axis2c_node_t *axis2c_create_node();
-//free a given nod
-void axis2c_free_node(axis2c_node_t *node);
-
-// add a node as a child of parent node
void axis2c_node_add_child(axis2c_node_t *parent,axis2c_node_t *child);
-// detach a node form the parent and reset the other links
+/**
+ * detach a node from the tree and resets the links
+ * @param node_to_detach the node to be detached
+ *
+ */
+
axis2c_node_t *axis2c_node_detach(axis2c_node_t *node_to_detach);
-// insert a sibling node
-void axis2c_node_insert_sibling_after(axis2c_node_t *current_ele,axis2c_node_t *nodeto_insert);
+/**
+ * inserts a sibling node after the current node
+ * @param current_node the node in consideration
+ * @param node_to_insert the node that will be inserted
+ */
+
+void axis2c_node_insert_sibling_after(axis2c_node_t *current_nodee,axis2c_node_t *node_to_insert);
void axis2c_node_insert_sibling_before(axis2c_node_t *current_ele,axis2c_node_t *nodeto_insert);
-// build the tree
-int axis2c_node_build(axis2c_node_t *node);
-void axis2c_node_set_parent(axis2c_node_t *node,axis2c_node_t *parent);
+//int axis2c_node_build(axis2c_node_t *node);
-axis2c_node_t *axis2c_node_get_next_sibling(axis2c_node_t *node);
+/**
+ * set a parent node to a given node
+ * @param node
+ * @param parent the node that will be set as parent
+ */
-axis2c_node_t *axis2c_node_set_next_sibling(axis2c_node_t *node);
+void axis2c_node_set_parent(axis2c_node_t *node,axis2c_node_t *parent);
-#endif // AXIS2C_NODE
+#endif // AXIS2C_NODE_H
Modified: webservices/axis2/trunk/c/include/axis2c_om_attribute.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_attribute.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_attribute.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_attribute.h Sun Oct 2 22:21:08 2005
@@ -17,24 +17,51 @@
#ifndef AXIS2C_OM_ATTRIBUTE_H
#define AXIS2C_OM_ATTRIBUTE_H
+/**
+ * @file axis2c_om_attribute.h
+ * @brief om attribute strcut represents an xml attribute
+ */
+
#include <axis2c_qname.h>
#include <axis2c_node.h>
#include <axis2c_om_namespace.h>
+/**
+ * localname
+ * value
+ * namespace
+ */
+
typedef struct axis2c_om_attribute_t{
char *localname;
char *value;
axis2c_om_namespace_t *ns;
}axis2c_om_attribute_t;
-axis2c_om_attribute_t *axis2c_create_om_attribute(const char *localname,const char *value, axis2c_om_namespace_t *ns);
-axis2c_qname_t *axis2c_om_attribute_get_qname(axis2c_om_attribute_t *attribute);
-void axis2c_om_attribute_free(axis2c_om_attribute_t *attr);
-
-
+/**
+ * creates an om_attribute structure
+ * @param localname
+ * @param value
+ * @param axis2c_om_namespace namespace
+ * @return The attribute struct just created
+ */
+
+axis2c_om_attribute_t *axis2c_om_attribute_create(const char *localname,const char *value, axis2c_om_namespace_t *ns);
+
+/**
+ * creates and returns a unique qname struct for this attribute
+ * @param attribute pointer to an attribute struct
+ * @return axis2c_qname_t struct
+ */
+axis2c_qname_t *axis2c_om_attribute_get_qname(axis2c_om_attribute_t *attribute);
+/**
+ * free a om attribute struct
+ * @param attr pointer to the struct to be freed
+ * @return
+ */
+void axis2c_om_attribute_free(axis2c_om_attribute_t *attr);
#endif // _AXISC_ATTRIBUTE_H_
-
Modified: webservices/axis2/trunk/c/include/axis2c_om_comment.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_comment.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_comment.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_comment.h Sun Oct 2 22:21:08 2005
@@ -16,28 +16,50 @@
#ifndef AXIS2C_OM_COMMENT_H
#define AXIS2C_OM_COMMENT_H
-#include <axis2c_node.h>
+/**
+ * @file axis2c_om_comment.h
+ * @brief defines axis2c_om_comment_t struct, and manipulation functions
+ */
+#include <axis2c_node.h>
typedef struct axis2c_om_comment_t
{
char *value;
}axis2c_om_comment_t;
-axis2c_node_t *axis2c_create_om_comment(const char *value);
-
-void axis2c_free_om_comment(axis2c_om_comment_t *comment_node);
+/**
+ * Create a comment struct and stores in in a node struct and returns a pointer
+ * to the axis2c_node_t struct
+ * the data_element field of node struct points to the acctual axis2c_comment struct
+ * The element type of axis2c_node_t struct will be of type AXIS2C_OM_COMMENT
+ * @return pointer to a node_t struct containing the comment struct
+ */
+axis2c_node_t *axis2c_om_comment_create(const char *value);
+
+/**
+ * free a axis2c_comment struct
+ * @param comment pointer to the axis2c_commnet
+ *
+ */
+
+void axis2c_om_comment_free(axis2c_om_comment_t *comment);
+
+/**
+ * to get the value of a existing comment node
+ * @param comment_node pointer to comment node
+ */
char *axis2c_om_comment_get_value(axis2c_node_t *comment_node);
-void axis2c_om_comment_set_value(axis2c_node_t *comment_node,const char *value);
-
-
-#endif // AXIS2C_OM_COMMENT_H
-
-
+/**
+ * to set the value of a existing comment node
+ * @param comment_node pointer to comment node
+ */
+void axis2c_om_comment_set_value(axis2c_node_t *comment_node,const char *value);
+#endif // AXIS2C_OM_COMMENT_H
Modified: webservices/axis2/trunk/c/include/axis2c_om_doctype.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_doctype.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_doctype.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_doctype.h Sun Oct 2 22:21:08 2005
@@ -16,22 +16,55 @@
#ifndef AXIS2C_OM_DOCTYPE_H
#define AXIS2C_OM_DOCTYPE_H
-#include <axis2c_node.h>
+/**
+ *@file axis2c_om_doctype.h
+ *@brief defines struct representing xml DTD and its manipulation functions
+ */
+
+#include <axis2c_node.h>
typedef struct axis2c_om_doctype_t
{
char *value;
}axis2c_om_doctype_t;
-axis2c_node_t *create_om_doctype(axis2c_node_t *parent,const char *value);
-
-axis2c_node_t *create_empty_om_doctype(axis2c_node_t *parent);
-
-void free_om_doctype(axis2c_om_doctype_t *om_doc);
-
+/**
+ * Create a doctype struct and stores in in a node struct and returns a pointer
+ * to the axis2c_node_t struct
+ * the data_element field of node struct points to the acctual axis2c_doctype_t struct
+ * The element type of axis2c_node_t struct will be of type AXIS2C_OM_DOCTYPE
+ * @return pointer to a axis2c_node_t struct containing the doctype struct
+ */
+
+axis2c_node_t *axis2c_om_doctype_create(axis2c_node_t *parent,const char *value);
+
+/**
+ * create an axis2c_om_doctype_t struct with parent
+ * value field will be set to null
+ * @return poniter to a axis2c_node_t
+ */
+
+
+axis2c_node_t *axis2c_om_doctype_create_empty_doctype(axis2c_node_t *parent);
+
+/**
+ * free the axis2c_om_doctype_t struct
+ * @param om_doc pointer to axis2c_om_doctype_t struct
+ */
+void axis2c_om_doctype_free(axis2c_om_doctype_t *om_doc);
+
+/**
+ * accessor function to get value of doctype
+ * @param om_doc pointer to axis2c_om_doctype_t struct
+ */
char *om_doctype_get_value(axis2c_node_t *doctype_node);
+/**
+ * mutator function to get value of doctype
+ * @param om_doc pointer to axis2c_om_doctype_t struct
+ * @param value value to be set in om_doctype
+ */
void om_doctype_set_value(axis2c_node_t *doctype_node,const char *value);
#endif // AXIS2C_OM_DOCTYPE_H
Modified: webservices/axis2/trunk/c/include/axis2c_om_document.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_document.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_document.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_document.h Sun Oct 2 22:21:08 2005
@@ -20,6 +20,13 @@
//typedef struct axis2c_stax_om_builder_t axis2c_stax_om_builder_t;
+/**
+ * @file axis2c_node.h
+ * @brief om_document represents a xml document
+ *
+ */
+
+
#define CHAR_SET_ENCODING "UTF-8"
#define XML_VERSION "1.0"
@@ -38,17 +45,65 @@
}axis2c_om_document_t;
-axis2c_om_document_t *axis2c_create_om_document_with_root(axis2c_node_t *root_ele,axis2c_stax_om_builder_t *builder);
+/**
+ * creates and returns axis2c_om_document returns null if there isn't enough memory
+ * @param root_ele pointer to document's root node IF NUll is parsed a document root
+ * will be set to NULL
+ * @param builder pointer to xml builder
+ */
+
+axis2c_om_document_t *axis2c_om_document_create(axis2c_node_t *root_ele,axis2c_stax_om_builder_t *builder);
+
+/**
+ * Free axis2c_om_document_t struct
+ * @param document
+ */
-axis2c_om_document_t *axis2c_create_om_document(axis2c_stax_om_builder_t *builder);
void axis2c_free_om_document(axis2c_om_document_t *document);
-axis2c_node_t *axis2c_om_document_get_document_element();
+/**
+ * causes the parser to proceed if the xml input is not finised yet
+ * @param document
+ */
-void axis2c_om_document_set_charset_encoding(axis2c_om_document_t *document,char *charset_encoding);
+void axis2c_om_document_build_next(axis2c_om_document_t *document);
+
+/**
+ * adds the child node as a child to the back of the list
+ */
void axis2c_om_document_add_child(axis2c_om_document_t *document,axis2c_node_t *child);
-#endif // AXIS2C_OM_DOCUMENT_H
+/**
+ * This cause the parser to proceed
+ * @param document
+ * @ returns The first
+ */
+
+
+axis2c_node_t *axis2c_om_document_get_first_child(axis2c_om_document_t *document);
+
+/**
+ * set the CHAR SET ENCODING of this document
+ */
+void axis2c_document_set_char_set_encoding(axis2c_om_document_t *char_set_encoding);
+
+/**
+ * set the xml version of this document
+ */
+void axis2c_document_set_xmlversion(axis2c_om_document_t *document);
+
+
+
+/* to implement
+ * get first child with qname
+ * get children iterator
+ * get children with name
+ */
+
+
+
+
+#endif // AXIS2C_OM_DOCUMENT_H
Modified: webservices/axis2/trunk/c/include/axis2c_om_element.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_element.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_element.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_element.h Sun Oct 2 22:21:08 2005
@@ -35,62 +35,104 @@
/*
-* Create an om element using localname and namespace
-*
+* Create an om element using localname and namespace and parent
+*@param localname can't be null
+*@param ns namespace can be null
+*@param parent can be null
+*@return Returns axis2c_node_t pointer If there isn't enough memory null is returned
*/
-axis2c_node_t *axis2c_create_om_element(const char *localname,axis2c_om_namespace_t *ns);
-/*
-* create om element using localname namespace and parent element
-*
-*/
-axis2c_node_t *axis2c_create_om_element_with_parent(const char *localname,axis2c_om_namespace_t *ns,axis2c_node_t *parent);
+axis2c_node_t *axis2c_om_element_create(const char *localname,axis2c_om_namespace_t *ns
+ ,axis2c_node_t *parent);
+/**
+ * create an om element using a qname
+ * @param qname
+ * @param parent
+ * @return axis2c_node_t pointer or NULL if there isn't enough memory
+ */
+
+
+axis2c_node_t *axis2c_om_element_create_with_qname(axis2c_qname_t *qname,axis2c_node_t *parent);
+
+axis2c_node_t *axis2c_om_element_create_with_builder(const char *localname
+ ,axis2c_om_namespace_t *ns,axis2c_node_t *parent,axis2c_stax_om_builder_t *builder);
+
-axis2c_node_t *axis2c_create_om_element_with_qname_parent(axis2c_qname_t *qname,axis2c_node_t *parent);
/*
* Find a namespace in the scope of the document
* start to find from current element and go up the hierarchy
-*
*/
+
axis2c_om_namespace_t *axis2c_om_element_find_namespace(
axis2c_node_t *element_node, const char *uri,const char *prefix);
/*
-declare a namespace in current element
+declare a namespace in current element (in the scope of this element )
*/
axis2c_om_namespace_t *axis2c_om_element_declare_namespace(axis2c_node_t *element_node,axis2c_om_namespace_t *ns);
-
+/**
+ * find namespaces in the scope of current element
+ */
axis2c_om_namespace_t *axis2c_om_element_find_declared_namespace(axis2c_node_t *element_node,const char *uri,const char *prefix);
+/**
+ * add an attribute to current element
+ */
axis2c_om_attribute_t *axis2c_om_element_add_attribute(axis2c_node_t *element_node,axis2c_om_attribute_t *attribute);
+/**
+ * return the requested attribute
+ */
axis2c_om_attribute_t *axis2c_om_element_get_attribute(axis2c_node_t *element_node,axis2c_qname_t *qname);
+/**
+ * add an attribute
+ */
-axis2c_om_attribute_t *axis2c_om_attribute_add_attribute_with_namespace(
+axis2c_om_attribute_t *axis2c_om_element_add_attribute_with_namespace(
axis2c_node_t* element_node,const char *attribute_name,const char *value,axis2c_om_namespace_t *ns);
-
-static char* axis2c_construct_key_from_qname(axis2c_qname_t *qname);
+/**
+ *
+ */
static axis2c_om_namespace_t *axis2c_om_element_handle_namespace_with_qname(axis2c_node_t *element_node,axis2c_qname_t *qname);
/*
void om_element_remove_attribute(om_element_t *element,om_attribute_t *attribute);
*/
+
+/**
+ * set the namespace of this element
+ */
+
void axis2c_om_element_set_namespace(axis2c_node_t *element_node,axis2c_om_namespace_t *ns);
+/**
+ * declare a namespace in the scope of this element
+ */
+
+axis2c_om_namespace_t *axis2c_om_element_declare_namespace_with_ns_uri_prefix(axis2c_node_t *element_node,const char* uri,const char *prefix);
+/**
+ * Free Om element
+ *
+ */
-axis2c_om_namespace_t *axis2c_om_element_declare_namespace_with_nsuri_prefix(axis2c_node_t *element_node,const char* uri,const char *prefix);
void axis2c_free_om_element(axis2c_om_element_t *element);
+/**
+ * set localname
+ */
void axis2c_om_element_set_localname(axis2c_node_t *element_node,const char *localname);
+/**
+ * get Localname
+ */
char *axis2c_om_element_get_localname(axis2c_node_t *element_node);
-#endif // _AXISC_OM_ELEMENT
+#endif // AXISC_OM_ELEMENT_H
Modified: webservices/axis2/trunk/c/include/axis2c_om_namespace.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_namespace.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_namespace.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_namespace.h Sun Oct 2 22:21:08 2005
@@ -17,14 +17,39 @@
#ifndef AXIS2C_OM_NAMESPACE_H
#define AXIS2C_OM_NAMESPACE_H
+/**
+ * @file axis2c_om_namespace.h
+ * @brief defines axis2c_om_namespace data structure, used for constructing the om tree and its
+ * manipulation functions
+ * represents an xml namespace
+ */
+
+#include <axis2c.h>
+
+
typedef struct axis2c_om_namespace_t {
char *uri;
char *prefix;
} axis2c_om_namespace_t;
+/**
+ * creates an axis2c_om_namespace
+ * @param axis2c_om_namesapce_t pointer to axis2c_om_namespace_t struct
+ */
+
+axis2c_om_namespace_t *axis2c_om_namespace_create(const char *uri, const char *prefix);
+
+/**
+ * free an om_namespcae
+ *
+ */
+void axis2c_om_namespace_free(axis2c_om_namespace_t * ns);
+/**
+ * compares two namepsaces
+ * @param ns1 ,ns2 namespace to be compared
+ * @return true if ns1 equals ns2 , false otherwise
+ */
-axis2c_om_namespace_t *axis2c_create_om_namespace(const char *uri, const char *prefix);
-void axis2c_free_om_namespace(axis2c_om_namespace_t * ns);
-int axis2c_om_namespace_equals(axis2c_om_namespace_t * ns1, axis2c_om_namespace_t * ns2);
+boolean_t axis2c_om_namespace_equals(axis2c_om_namespace_t * ns1, axis2c_om_namespace_t * ns2);
#endif // AXIS2C_OM_NAMESPACE
Modified: webservices/axis2/trunk/c/include/axis2c_om_processing_instruction.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_processing_instruction.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_processing_instruction.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_processing_instruction.h Sun Oct 2 22:21:08 2005
@@ -16,6 +16,12 @@
#ifndef AXIS2C_OM_PI_H
#define AXIS2C_OM_PI_H
+
+/**
+ * @file axis2c_om_processing_instruction.h
+ * @brief represents a xml processing instruction also known as PI
+ */
+
#include <axis2c_node.h>
typedef struct axis2c_om_processing_instruction_t {
@@ -23,27 +29,28 @@
char *value;
} axis2c_om_processing_instruction_t;
-axis2c_node_t
- *axis2c_create_om_processing_instruction_with_parent(axis2c_node_t *
- parent,
- const char
- *target,
- const char
- *value);
-
-axis2c_node_t *axis2c_create_om_processing_instruction(axis2c_node_t *
- parent);
-
-void axis2c_om_processing_instruction_serialize_with_cache(FILE *
- output_stream);
-
-void
-axis2c_om_processing_instruction_discard(axis2c_om_processing_instruction_t
- * om_pi);
+/**
+ * creates axis2c_om_processing_instruction and
+ * @return a pointer to axis2c_node_t struct containing PI
+ */
+
+axis2c_node_t *axis2c_om_processing_instruction_create(axis2c_node_t *parent
+ ,const char *target,const char *value);
+/**
+ * creates empty axis2c_om_processing_instruction and
+ * @return a pointer to axis2c_node_t struct containing PI
+ */
+axis2c_node_t *axis2c_create_om_processing_instruction_create_empty(axis2c_node_t *parent);
+void axis2c_om_processing_instruction_serialize_with_cache(FILE *output_stream);
+/**
+ *
+ *
+ */
+void axis2c_om_processing_instruction_discard(axis2c_om_processing_instruction_t *om_pi);
#endif // AXIS2C_OM_PI_H
Modified: webservices/axis2/trunk/c/include/axis2c_om_text.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_om_text.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_om_text.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_om_text.h Sun Oct 2 22:21:08 2005
@@ -16,31 +16,59 @@
#ifndef AXIS2C_OM_TEXT_H
#define AXIS2C_OM_TEXT_H
+
+/**
+ * @file axis2c_om_attribute.h
+ * @brief represents xml text element
+ */
+
+
#include <axis2c_om_attribute.h>
typedef struct axis2c_om_text_t
{
char *value;
-
+ axis2c_om_namespace_t *ns;
+
char *mime_type;
int optimize;
+ char *localname;
int is_binary;
char *content_id;
axis2c_om_attribute_t *attribute;
-
}axis2c_om_text_t;
-axis2c_node_t *axis2c_create_om_text(const char *value);
+/**
+ * Create a text struct and stores in in a node struct and returns a pointer
+ * to the axis2c_node_t struct
+ * the data_element field of node struct points to the acctual axis2c_text_t struct
+ * The element type of axis2c_node_t struct will be of type AXIS2C_OM_TEXT
+ * @param parent This can be null The parent element should be of type AXIS2C_OM_ELEMENT
+ * @return pointer to a axis2c_node_t struct containing the text struct
+ */
+
+axis2c_node_t *axis2c_om_text_create(axis2c_node_t *parent,const char *value);
+
+
+/**
+ * access the value of the text struct
+ * @param textnode node
+ * @return char * to the value
+ */
char* axis2c_om_text_get_text(axis2c_om_text_t *textnode);
-axis2c_node_t *axis2c_create_om_text_with_parent(axis2c_node_t *parent,const char *value);
-
-
+/**
+ * free an axis2c_om_text_t structure
+ */
+
+void axis2c_om_text_free(axis2c_om_text_t *text);
+/**
+ * axis2c
+ *
+ */
#endif // AXIS2C_OM_TEXT_H
-
-
Modified: webservices/axis2/trunk/c/include/axis2c_qname.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_qname.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_qname.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_qname.h Sun Oct 2 22:21:08 2005
@@ -17,6 +17,14 @@
#ifndef AXISC_QNAME_H
#define AXISC_QNAME_H
+
+/**
+ * @file axis2c_qname.h
+ * @brief represents a qualified name
+ */
+
+#include <axis2c.h>
+
static const char XML_NAMESPACE_URI[] ="http://www.w3c.org/XML/1998/namespace";
typedef struct axis2c_qname_t{
@@ -26,8 +34,22 @@
}axis2c_qname_t;
-axis2c_qname_t *axis2c_create_qname(const char *localname,const char *ns_uri,const char *prefix);
-void axis2c_free_qname(axis2c_qname_t *qn);
+/**
+ * creates a qname struct
+ *
+ */
-#endif // AXISC_QNAME_H
+axis2c_qname_t *axis2c_qname_create(const char *localname,const char *ns_uri,const char *prefix);
+/**
+ * Free a qname struct
+ */
+void axis2c_qname_free(axis2c_qname_t *qn);
+/**
+ * compare tow qname structs and returns true (1) if equals and false (0) otherwise
+ *
+ */
+
+boolean_t axis2c_qname_equals(axis2c_qname_t *qn1,axis2c_qname_t *qn2);
+
+#endif // AXISC_QNAME_H
Modified: webservices/axis2/trunk/c/include/axis2c_stax_ombuilder.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2c_stax_ombuilder.h?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2c_stax_ombuilder.h (original)
+++ webservices/axis2/trunk/c/include/axis2c_stax_ombuilder.h Sun Oct 2 22:21:08 2005
@@ -17,6 +17,13 @@
#ifndef AXIS2C_STAX_OMBUILDER_H
#define AXIS2C_STAX_OMBUILDER_H
+/**
+ * @file axis2c_stax_om_builder.h
+ * @brief om model stax builder
+ */
+
+
+
#define XMLNS_URI "http://www.w3.org/XML/1998/namespace"
#define XMLNS_PREFIX "xml"
@@ -26,58 +33,94 @@
struct axis2c_stax_om_builder_s
{
- XML_PullParser *parser;
- axis2c_node_t *lastnode;
- axis2c_om_document_t *document;
- int done;
- int parser_accessed;
- int cache;
-
+ XML_PullParser *parser;
+ axis2c_node_t *lastnode;
+ axis2c_om_document_t *document;
+ boolean_t done;
+ boolean_t parser_accessed;
+ boolean_t cache;
};
+/**
+ * create an stax_om_builder
+ * @param parser This is the XMLStreamReader of xmlparser
+ * [ Guththila ]
+ */
+
+axis2c_stax_om_builder_t *axis2c_stax_om_builder_create(XML_PullParser *parser);
+
+/**
+ * Create an om element and adds to the document
+ * @param builder pointer to the builder
+ * @param returns a pointer to axis2c_node_t containing the element or NULL if there
+ * isn't enough memory
+ */
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_element(
+ axis2c_stax_om_builder_t *builder);
+
+/**
+ * creates an om comment
+ * @param builder
+ * @returns
+ */
+
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_comment(
+ axis2c_stax_om_builder_t *builder);
+
+/**
+ * create an om doctype
+ *
+ */
+axis2c_node_t *axis2c_stax_om_builder_create_om_doctype(
+ axis2c_stax_om_builder_t *builder_t);
+
+/**
+ * create om_processing_instruction
+ */
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_processing_instruction(
+ axis2c_stax_om_builder_t *builder);
+
+/**
+ * End element processing
+ */
+void axis2c_stax_om_builder_end_element(axis2c_stax_om_builder_t *builder);
+/**
+ * move parser forward and reacts to events
+ */
-axis2c_stax_om_builder_t *axis2c_create_stax_om_builder(XML_PullParser *parser);
-
-axis2c_stax_om_builder_t *axis2c_create_stax_om_builder(XML_PullParser *parser);
-
-axis2c_node_t *axis2c_stax_om_builder_create_om_element(axis2c_stax_om_builder_t *builder);
-
-axis2c_node_t *axis2c_stax_om_builder_create_om_comment(axis2c_stax_om_builder_t *builder);
-
-axis2c_node_t *axis2c_stax_om_builder_create_om_doctype(axis2c_stax_om_builder_t *builder_t);
-
-axis2c_node_t *axis2c_stax_om_builder_create_om_pi(axis2c_stax_om_builder_t *builder);
+int axis2c_stax_om_builder_next(axis2c_stax_om_builder_t *builder);
-void axis2c_stax_om_builder_end_element(axis2c_stax_om_builder_t *builder);
+/**
+ * process attrbites
+ *
+ */
void axis2c_stax_om_builder_process_attributes(axis2c_stax_om_builder_t *builder,axis2c_node_t *element_node);
+/**
+ * create om text
+ *
+ */
axis2c_node_t *axis2c_stax_om_builder_create_om_text(axis2c_stax_om_builder_t *builder);
-void axis2c_stax_om_builder_discard(axis2c_stax_om_builder_t *builder,axis2c_node_t *element_node);
+/**
+ * discard building an element
+ */
-void axis2c_stax_om_builder_end_element(axis2c_stax_om_builder_t *builder);
-int axis2c_stax_om_builder_next(axis2c_stax_om_builder_t *builder);
+void axis2c_stax_om_builder_discard(axis2c_stax_om_builder_t *builder,axis2c_node_t *element_node);
-axis2c_node_t *axis2c_stax_om_builder_get_document_element(axis2c_stax_om_builder_t *builder);
+/**
+ * process namespaces
+ *
+ */
axis2c_node_t *axis2c_stax_om_builder_process_namespace_data(axis2c_stax_om_builder_t *builder,axis2c_node_t *element,int is_soap_element);
-
-
-
-
-
-
-
-
-
-
-
-
#endif // AXIS2C_STAX_OMBUILDER_H
-
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=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/project.properties (original)
+++ webservices/axis2/trunk/c/modules/xml/om/project.properties Sun Oct 2 22:21:08 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.tests=om_test
freehep.nar.linker.test.arg.end=-Ltarget/nar/lib/i386-Linux-g++ -laxis2c-xml-om-nar-0.0
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_node.c Sun Oct 2 22:21:08 2005
@@ -16,11 +16,11 @@
#include <axis2c_node.h>
-axis2c_node_t *axis2c_create_node()
+axis2c_node_t *axis2c_node_create()
{
axis2c_node_t *node = (axis2c_node_t *) malloc(sizeof(axis2c_node_t));
- if (!node)
+ if (!node)
{
return NULL;
}
@@ -38,19 +38,18 @@
}
-void axis2c_free_node(axis2c_node_t * node)
+void axis2c_node_free(axis2c_node_t * node)
{
if (!node)
return;
-
-
}
void axis2c_node_add_child(axis2c_node_t * parent, axis2c_node_t * child)
{
if (!parent || !child)
- return;
-
+ {
+ return;
+ }
if (parent->first_child == NULL)
{
parent->first_child = child;
@@ -103,13 +102,12 @@
node_to_detach->parent = NULL;
return node_to_detach;
-
}
void axis2c_node_set_parent(axis2c_node_t * node,axis2c_node_t *parent)
{
if(!parent || !node)
- {/*null pointers */
+ {
return ;
}
@@ -117,7 +115,8 @@
{/* same parent already exist */
return ;
}
- /* if a new parent is assigned in place of existing one first the node should be detached */
+ /* if a new parent is assigned in place of existing */
+ /* one first the node should be detached */
if(!(node->parent))
{
@@ -128,51 +127,51 @@
/**
* 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
+ * @param node the node in consideration
+ * @param nodeto_insert the node that will be inserted
*/
-void axis2c_node_insert_sibling_after(axis2c_node_t *node,axis2c_node_t *nodeto_insert)
+void axis2c_node_insert_sibling_after(axis2c_node_t *node,
+ axis2c_node_t *node_to_insert)
{
- if(!node || !nodeto_insert )
+ if(!node || !node_to_insert )
{
return ;
}
- nodeto_insert->parent = node->parent;
- nodeto_insert->prev_sibling = node;
+ node_to_insert->parent = node->parent;
+ node_to_insert->prev_sibling = node;
if(node->next_sibling)
{
- node->next_sibling->prev_sibling = nodeto_insert;
+ node->next_sibling->prev_sibling = node_to_insert;
}
- nodeto_insert->next_sibling = node->next_sibling;
- node->next_sibling = nodeto_insert;
+ node_to_insert->next_sibling = node->next_sibling;
+ node->next_sibling = node_to_insert;
}
-void axis2c_node_insert_sibling_before(axis2c_node_t *node,axis2c_node_t *nodeto_insert)
+void axis2c_node_insert_sibling_before(axis2c_node_t *node,
+ axis2c_node_t *node_to_insert)
{
- if(!node || !nodeto_insert )
+ if(!node || !node_to_insert )
{
return;
}
- nodeto_insert->parent = node->parent;
+ node_to_insert->parent = node->parent;
- nodeto_insert->prev_sibling = node->prev_sibling;
- nodeto_insert->next_sibling = node;
+ node_to_insert->prev_sibling = node->prev_sibling;
+ node_to_insert->next_sibling = node;
if(!(node->prev_sibling))
{
- node->parent->first_child = nodeto_insert;
+ node->parent->first_child = node_to_insert;
}
else
{
- node->prev_sibling->next_sibling = nodeto_insert;
+ node->prev_sibling->next_sibling = node_to_insert;
}
- node->prev_sibling = nodeto_insert;
+ node->prev_sibling = node_to_insert;
}
-
-
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_attribute.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_attribute.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_attribute.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_attribute.c Sun Oct 2 22:21:08 2005
@@ -14,25 +14,18 @@
* limitations under the License.
*/
-
-
-
-
#include <axis2c_om_attribute.h>
#include <string.h>
-axis2c_om_attribute_t *axis2c_create_om_attribute(const char *localname,
- const char *value,
- axis2c_om_namespace_t *
- ns)
+axis2c_om_attribute_t *axis2c_om_attribute_create(const char *localname,
+ const char *value,axis2c_om_namespace_t *ns)
{
- axis2c_om_attribute_t *attr =
- (axis2c_om_attribute_t *) malloc(sizeof(axis2c_om_attribute_t));
+ axis2c_om_attribute_t *attr = (axis2c_om_attribute_t *) malloc(
+ sizeof(axis2c_om_attribute_t));
if (!attr)
{
-
- return NULL;
+ return NULL;
}
attr->localname = strdup(localname);
@@ -45,30 +38,37 @@
{
if (attr)
{
- free(attr->localname);
- free(attr->value);
- /* should namespace pointer be ...
- */
-
- }
+ if(attr->localname)
+ {
+ free(attr->localname);
+ }
+ if(attr->value)
+ {
+ free(attr->value);
+ }
+ if(attr->ns)
+ {
+ axis2c_om_namespace_free(attr->ns);
+ }
+ free(attr);
+ }
}
axis2c_qname_t *axis2c_om_attribute_get_qname(axis2c_om_attribute_t * attr)
{
- axis2c_qname_t *qn = NULL;
- if (attr)
- {
- if (attr->ns)
- {
- qn = axis2c_create_qname(attr->localname, attr->ns->uri,
- attr->ns->prefix);
- } else
+ axis2c_qname_t *qname = NULL;
+ if (!attr)
{
- qn = axis2c_create_qname(attr->localname, NULL, NULL);
+ return NULL;
}
- return qn;
- }
- return NULL;
-
+ if (attr->ns)
+ {
+ qname = axis2c_qname_create(attr->localname, attr->ns->uri,attr->ns->prefix);
+ }
+ else
+ {
+ qname = axis2c_qname_create(attr->localname, NULL, NULL);
+ }
+ return qname;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_comment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_comment.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_comment.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_comment.c Sun Oct 2 22:21:08 2005
@@ -18,29 +18,28 @@
#include <string.h>
#include <axis2c_errno.h>
-axis2c_node_t *axis2c_create_om_comment(const char *value)
+axis2c_node_t *axis2c_om_comment_create(const char *value)
{
axis2c_node_t *node = NULL;
axis2c_om_comment_t *comment = NULL;
- node = axis2c_create_node();
+ node = axis2c_node_create();
if (!node)
{
- fprintf(stderr, "%d Error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
- return NULL;
+ fprintf(stderr, "%d Error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
}
comment = (axis2c_om_comment_t *) malloc(sizeof(axis2c_om_comment_t));
if (!comment)
{
- free(node);
- fprintf(stderr, "%d Error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
- return NULL;
-
+ free(node);
+ fprintf(stderr, "%d Error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
}
comment->value = strdup(value);
if (!comment->value)
{
- fprintf(stderr, "%d Error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ fprintf(stderr, "%d Error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
}
node->data_element = comment;
@@ -53,41 +52,37 @@
{
if (comment)
{
- if (comment->value)
- free(comment->value);
- free(comment);
+ if (comment->value)
+ {
+ free(comment->value);
+ }
+ free(comment);
}
}
-/*
-* returns a duplicated string as value
-*
-*/
-
char *axis2c_om_comment_get_value(axis2c_node_t * comment_node)
{
if (!comment_node || comment_node->element_type !=AXIS2C_OM_COMMENT)
{
- return NULL;
+ return NULL;
}
- return strdup(((axis2c_om_comment_t *) (comment_node->data_element))->
- value);
+ return ((axis2c_om_comment_t *) (comment_node->data_element))->value;
}
void axis2c_om_comment_set_value(axis2c_node_t * comment_node,
const char *value)
{
- axis2c_om_comment_t *comm = NULL;
+ axis2c_om_comment_t *comment = NULL;
if (!comment_node || comment_node->element_type !=AXIS2C_OM_COMMENT)
{
- return;
+ return;
}
- comm = ((axis2c_om_comment_t *) (comment_node->data_element));
+ comment = ((axis2c_om_comment_t *) (comment_node->data_element));
- if (comm->value)
+ if (comment->value)
{
- free(comm->value);
+ free(comment->value);
}
- comm->value = strdup(value);
+ comment->value = strdup(value);
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_doctype.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_doctype.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_doctype.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_doctype.c Sun Oct 2 22:21:08 2005
@@ -16,57 +16,62 @@
#include <axis2c_om_doctype.h>
#include <stdlib.h>
+#include <axis2c_errno.h>
-axis2c_node_t *axis2c_create_om_doctype(axis2c_node_t * parent,
- const char *value)
+axis2c_node_t *axis2c_create_om_doctype(axis2c_node_t * parent,const char *value)
{
axis2c_om_doctype_t *doctype = NULL;
- axis2c_node_t *node = axis2c_create_node();
+ axis2c_node_t *node = axis2c_node_create();
if (!node)
{
- //fprintf(stderr,"Error");
- return NULL;
+ return NULL;
}
doctype = (axis2c_om_doctype_t *) malloc(sizeof(axis2c_om_doctype_t));
if (!doctype)
{
- free(node);
- return NULL;
+ fprintf(stderr,"%d Error",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ free(node);
+ return NULL;
}
- doctype->value = strdup(value);
+ doctype->value = strdup(value);
+
node->data_element = doctype;
- node->element_type =AXIS2C_OM_DOCTYPE;
- if (parent)
+
+ node->element_type = AXIS2C_OM_DOCTYPE;
+
+ if (parent)
{
- node->parent = parent;
- axis2c_node_add_child(parent, node);
+ node->parent = parent;
+ axis2c_node_add_child(parent, node);
}
return node;
}
-axis2c_node_t *axis2c_create_empty_om_doctype(axis2c_node_t * parent)
+axis2c_node_t *axis2c_om_doctype_create_empty_doctype(axis2c_node_t * parent)
{
axis2c_node_t *node = NULL;
axis2c_om_doctype_t *doctype = NULL;
if (!node)
- { // error handling
- return NULL;
+ {
+ return NULL;
}
doctype = (axis2c_om_doctype_t *) malloc(sizeof(axis2c_om_doctype_t));
if (!doctype)
{
- free(node);
- return NULL;
+ free(node);
+ return NULL;
}
- doctype->value = NULL;
+
+ doctype->value = NULL;
node->data_element = doctype;
node->element_type =AXIS2C_OM_DOCTYPE;
- if (parent)
+
+ if (parent)
{
- node->parent = parent;
- axis2c_node_add_child(parent, node);
+ node->parent = parent;
+ axis2c_node_add_child(parent, node);
}
return node;
}
@@ -75,9 +80,11 @@
{
if (om_doc)
{
- if (om_doc->value)
- free(om_doc->value);
- free(om_doc);
+ if (om_doc->value)
+ {
+ free(om_doc->value);
+ }
+ free(om_doc);
}
}
@@ -85,23 +92,22 @@
{
if (!doctype_node || doctype_node->element_type !=AXIS2C_OM_DOCTYPE)
{
- return NULL;
+ return NULL;
}
- return strdup(((axis2c_om_doctype_t *) (doctype_node->data_element))->
- value);
+ return ((axis2c_om_doctype_t *) (doctype_node->data_element))->value;
}
-void axis2c_om_doctype_set_value(axis2c_node_t * doctype_node,
- const char *value)
+
+void axis2c_om_doctype_set_value(axis2c_node_t * doctype_node,const char *value)
{
axis2c_om_doctype_t *doctype = NULL;
if (!doctype_node || doctype_node->element_type !=AXIS2C_OM_DOCTYPE)
{
- return;
+ return;
}
doctype = (axis2c_om_doctype_t *) (doctype_node->data_element);
if (doctype->value)
{
- free(doctype->value);
+ free(doctype->value);
}
doctype->value = strdup(value);
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_document.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_document.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_document.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_document.c Sun Oct 2 22:21:08 2005
@@ -17,19 +17,18 @@
#include <axis2c_om_document.h>
#include <stdlib.h>
+#include <axis2c_errno.h>
-
-axis2c_om_document_t *axis2c_create_om_document_with_root(axis2c_node_t *
- root_ele,
- axis2c_stax_om_builder_t
- * builder)
+axis2c_om_document_t *axis2c_om_document_create(axis2c_node_t * root_ele,
+ axis2c_stax_om_builder_t * builder)
{
- axis2c_om_document_t *doc =
- (axis2c_om_document_t *) malloc(sizeof(axis2c_om_document_t));
+ axis2c_om_document_t *doc = (axis2c_om_document_t *) malloc(
+ sizeof(axis2c_om_document_t));
if (!doc)
{
-
+ fprintf(stderr,"%d Error",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
}
doc->builder = builder;
doc->root_element = root_ele;
@@ -40,81 +39,70 @@
return doc;
}
-axis2c_om_document_t *axis2c_create_om_document(axis2c_stax_om_builder_t *
- builder)
-{
- axis2c_om_document_t *doc =
- (axis2c_om_document_t *) malloc(sizeof(axis2c_om_document_t));
- if (!doc)
- {
- return NULL;
- }
- //doc->builder = builder;
- doc->char_set_encoding = strdup(CHAR_SET_ENCODING);
- doc->xml_version = strdup(XML_VERSION);
- doc->done = FALSE;
- doc->first_child = NULL;
- doc->last_child = NULL;
- return doc;
-}
void axis2c_free_om_document(axis2c_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);
+ }
}
-axis2c_node_t *axis2c_om_document_get_document_element(axis2c_om_document_t
- * document)
-{
- //while(document->root_element == NULL)
- //{}
- return document->root_element;
-}
-
-void axis2c_om_document_set_charset_encoding(axis2c_om_document_t *
- document,
- char *charset_encoding)
-{
- if (document)
- {
- if (document->char_set_encoding)
- free(document->char_set_encoding);
-
- document->char_set_encoding = strdup(charset_encoding);
- }
-}
-char *axis2c_om_document_get_charset_encoding(axis2c_om_document_t *
- document)
+void axis2c_om_document_set_char_set_encoding(axis2c_om_document_t *document,
+ const char *char_set_encoding)
{
if (document)
{
- return document->char_set_encoding;
+ if (document->char_set_encoding)
+ {
+ free(document->char_set_encoding);
+ }
+ document->char_set_encoding = strdup(char_set_encoding);
}
-
- return NULL;
}
-
void axis2c_om_document_add_child(axis2c_om_document_t * document,
axis2c_node_t * child)
{
- if (!document || !child || child->element_type != AXIS2C_OM_ELEMENT)
- {
- //error
- return;
-
- }
+ if (!document || !child)
+ { /* nothing to do */
+ return;
+ }
if (document->first_child == NULL)
{
- document->first_child = child;
- child->prev_sibling = NULL;
- } else
+ document->first_child = child;
+ child->prev_sibling = NULL;
+ }
+ else
{
- child->prev_sibling = document->last_child;
- document->last_child->next_sibling = child;
+ child->prev_sibling = document->last_child;
+ document->last_child->next_sibling = child;
}
child->next_sibling = NULL;
+}
+
+
+void axis2c_om_document_set_xmlversion(axis2c_om_document_t *document,const char *xmlversion)
+{
+ if(document)
+ {
+ if(document->xml_version)
+ {
+ free(document->xml_version);
+ }
+ document->xml_version = strdup(xmlversion);
+ }
+}
+
+
+void axis2c_om_document_build_next(axis2c_om_document_t *document)
+{
+ axis2c_stax_om_builder_next(document->builder);
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_element.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_element.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_element.c Sun Oct 2 22:21:08 2005
@@ -14,167 +14,189 @@
* limitations under the License.
*/
+#include <axis2c_errno.h>
#include <axis2c_om_element.h>
#include <axis2c_om_attribute.h>
+#include <axis2c_om_namespace.h>
#include <stdlib.h>
static apr_pool_t *om_pool;
-axis2c_node_t *axis2c_create_om_element(const char *localname,
- axis2c_om_namespace_t * ns)
+axis2c_node_t *axis2c_om_element_create(const char *localname,axis2c_om_namespace_t * ns
+ ,axis2c_node_t *parent)
{
- axis2c_node_t *node = axis2c_create_node();
- if (node)
+ axis2c_node_t *node;
+ axis2c_om_element_t *element;
+ if(!localname)
+ {
+ fprintf(stderr,"Localname can't be null");
+ return NULL;
+ }
+
+ node = axis2c_node_create();
+ if (!node)
{
- axis2c_om_element_t *element =
- (axis2c_om_element_t *) malloc(sizeof(axis2c_om_element_t));
- if (element)
+ fprintf(stderr,"%d Error",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ element = (axis2c_om_element_t *) malloc(sizeof(axis2c_om_element_t));
+
+ if(!element)
{
- element->localname = strdup(localname);
- element->ns = ns;
- element->pns_counter = 0;
- element->attributes = NULL;
- element->namespaces = NULL;
- } else
+ axis2c_node_free(node);
+ return NULL;
+ }
+ element->ns = NULL;
+ element->localname = strdup(localname);
+ element->pns_counter = 0;
+ element->attributes = NULL;
+ element->namespaces = NULL;
+
+ if(parent)
{
- //could not allocate memory
- free(node);
- return NULL;
+ node->parent = parent;
+ axis2c_node_add_child(parent,node);
}
-
+ node->done = true;
node->element_type = AXIS2C_OM_ELEMENT;
node->data_element = element;
+ axis2c_om_element_set_namespace(node,ns);
+
return node;
- }
- return NULL;
+
}
-// create an om element using localname namespace and parent element
-
-axis2c_node_t *axis2c_create_om_element_with_parent(const char *localname,
- axis2c_om_namespace_t *
- ns,
- axis2c_node_t * parent)
-{
- axis2c_node_t *curr_node = axis2c_create_om_element(localname, ns);
- if (!curr_node)
- {
- //unable to create an element
- return NULL;
- }
- curr_node->done = TRUE;
- if (!parent)
- return curr_node;
-
- curr_node->parent = parent;
- axis2c_node_add_child(parent, curr_node);
- return curr_node;
-}
-
-// create an om_element using qname and parent
-axis2c_node_t *axis2c_create_om_element_with_qname_parent(axis2c_qname_t *
- qname,
- axis2c_node_t *
- parent)
+/* create an om_element using qname and parent */
+axis2c_node_t *axis2c_om_element_create_with_qname(axis2c_qname_t *qname
+ ,axis2c_node_t *parent)
{
axis2c_node_t *node = NULL;;
if (!qname)
{
- return NULL; // can't create an element
-
+ return NULL; /* can't create an element */
}
- node = axis2c_create_om_element_with_parent(qname->localpart, NULL,
- parent);
+ node = axis2c_om_element_create(qname->localpart, NULL,parent);
if (node)
{
- ((axis2c_om_element_t *) (node->data_element))->ns =
- axis2c_om_element_handle_namespace_with_qname(node, qname);
+ ((axis2c_om_element_t *) (node->data_element))->ns =
+ axis2c_om_element_handle_namespace_with_qname(node,qname);
}
return node;
}
+axis2c_node_t *axis2c_om_element_create_with_builder(const char *localname,axis2c_om_namespace_t *ns
+ ,axis2c_node_t *parent,axis2c_stax_om_builder_t *builder)
+{ axis2c_node_t *node;
+ axis2c_om_element_t *element;
+ if(!localname)
+ {
+ fprintf(stderr,"Localname can't be null");
+ return NULL;
+ }
-axis2c_om_namespace_t *axis2c_om_element_find_namespace(axis2c_node_t *
- element_node,
- const char *uri,
- const char *prefix)
-{
- //om_element_t *ele=NULL;
- axis2c_om_namespace_t *ns = NULL;
- if (!element_node)
+ node = axis2c_node_create();
+ if (!node)
{
- return NULL;
+ fprintf(stderr,"%d Error",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ element = (axis2c_om_element_t *) malloc(sizeof(axis2c_om_element_t));
+
+ if(!element)
+ {
+ axis2c_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 = AXIS2C_OM_ELEMENT;
+
+ if(parent)
+ {
+ node->parent = parent;
+ axis2c_node_add_child(parent,node);
+ }
+ axis2c_om_element_set_namespace(node,ns);
+ return node;
+}
+
+axis2c_om_namespace_t *axis2c_om_element_find_namespace(axis2c_node_t
+ *element_node,const char *uri,const char *prefix)
+{
+ axis2c_om_namespace_t *ns = NULL;
+
+ if (!element_node)
+ {
+ return NULL;
}
- if (!(element_node->data_element)
- || element_node->element_type !=AXIS2C_OM_ELEMENT)
+ if (!(element_node->data_element) || element_node->element_type !=AXIS2C_OM_ELEMENT)
{
- // wrong element type or null node
-
- return NULL;
+ /* wrong element type or null node */
+ return NULL;
}
- //ele = (om_element_t *)(element_node->data_element);
-
-
- ns = axis2c_om_element_find_declared_namespace(element_node, uri,
- prefix);
+
+ ns = axis2c_om_element_find_declared_namespace(element_node, uri,prefix);
if (!ns)
{
- return ns;
+ return ns;
}
- if ((element_node->parent != NULL)
- && (element_node->parent->element_type ==AXIS2C_OM_ELEMENT))
+ if ((element_node->parent != NULL) &&
+ (element_node->parent->element_type ==AXIS2C_OM_ELEMENT))
{
- axis2c_om_element_find_namespace(element_node->parent, uri,
- prefix);
+ axis2c_om_element_find_namespace(element_node->parent, uri, prefix);
}
return NULL;
}
-// declare a namespace for this om element
+/* declare a namespace for this om element */
axis2c_om_namespace_t *axis2c_om_element_declare_namespace(axis2c_node_t *
- element_node,
- axis2c_om_namespace_t
- * ns)
+ element_node,axis2c_om_namespace_t *ns)
{
apr_status_t status;
axis2c_om_element_t *element = NULL;
if (!element_node || !ns || !element_node->data_element
- || element_node->element_type != AXIS2C_OM_ELEMENT)
+ || element_node->element_type != AXIS2C_OM_ELEMENT)
{
- return NULL;
+ return NULL;
}
+
element = (axis2c_om_element_t *) (element_node->data_element);
- if (!element->namespaces)
+
+ if (!element->namespaces)
{
- if (!om_pool)
- {
- status = apr_pool_create(&om_pool, NULL);
- }
- element->namespaces = apr_hash_make(om_pool);
+ 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;
+
+ return ns;
}
-axis2c_om_namespace_t
- *
-axis2c_om_element_declare_namespace_with_ns_uri_prefix(axis2c_node_t *
- element_node,
- const char *uri,
- const char *prefix)
+axis2c_om_namespace_t *axis2c_om_element_declare_namespace_with_ns_uri_prefix(
+ axis2c_node_t *element_node,const char *uri,const char *prefix)
{
axis2c_om_namespace_t *nsp = NULL;
- nsp = axis2c_create_om_namespace(uri, prefix);
-
+ nsp = axis2c_om_namespace_create(uri, prefix);
if (nsp)
-
- return axis2c_om_element_declare_namespace(element_node, nsp);
-
+ {
+ return axis2c_om_element_declare_namespace(element_node, nsp);
+ }
return NULL;
}
@@ -183,11 +205,8 @@
* can be used to retrive a prefix of a known namespace uri
*
*/
-axis2c_om_namespace_t
- *axis2c_om_element_find_declared_namespace(axis2c_node_t *
- element_node,
- const char *uri,
- const char *prefix)
+axis2c_om_namespace_t *axis2c_om_element_find_declared_namespace(
+ axis2c_node_t *element_node,const char *uri,const char *prefix)
{
void *ns = NULL;
apr_hash_index_t *hashindex;
@@ -201,12 +220,14 @@
element = (axis2c_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))
+ for(hashindex = apr_hash_first(om_pool,element->namespaces);
+ hashindex;hashindex = apr_hash_next(hashindex))
{
apr_hash_this(hashindex,NULL,NULL,&ns);
if(strcmp(((axis2c_om_namespace_t*)(ns))->uri,uri))
+ {
return (axis2c_om_namespace_t*)(ns);
-
+ }
}
}
ns = apr_hash_get(element->namespaces, prefix, APR_HASH_KEY_STRING);
@@ -221,228 +242,130 @@
-static axis2c_om_namespace_t
- *axis2c_om_element_handle_namespace_with_qname(axis2c_node_t *
- element_node,
- axis2c_qname_t * qname)
+static axis2c_om_namespace_t *axis2c_om_element_handle_namespace_with_qname(
+ axis2c_node_t *element_node,axis2c_qname_t * qname)
{
axis2c_om_namespace_t *pns = NULL;
char *ns_uri = qname->ns_uri;
if (ns_uri != NULL)
{
- pns =
- axis2c_om_element_find_namespace(element_node, ns_uri,
- qname->prefix);
+ pns = axis2c_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 =
- axis2c_om_element_declare_namespace_with_ns_uri_prefix
- (element_node, ns_uri, qname->prefix);
- }
- }
+ if (pns == NULL)
+ {
+ if (qname->prefix)
+ {
+ pns = axis2c_om_element_declare_namespace_with_ns_uri_prefix(
+ element_node, ns_uri, qname->prefix);
+ }
+ }
}
return NULL;
}
-
-
-
-
-
-
-static axis2c_om_namespace_t
- *axis2c_om_element_handle_namespace(axis2c_node_t * element_node,
- axis2c_om_namespace_t * ns)
+static axis2c_om_namespace_t *axis2c_om_element_handle_namespace(axis2c_node_t
+ *element_node,axis2c_om_namespace_t *ns)
{
axis2c_om_namespace_t *ns1 = NULL;
if (!ns || !element_node)
{
-
- }
- ns1 =
- axis2c_om_element_find_namespace(element_node, ns->uri,
- ns->prefix);
-
- if (!ns1)
- {
- ns1 = axis2c_om_element_declare_namespace(element_node, ns);
+ return NULL;
}
- return ns1;
+ ns1 = axis2c_om_element_find_namespace(element_node,ns->uri,ns->prefix);
+
+ if(!ns1)
+ {
+ ns1 = axis2c_om_element_declare_namespace(element_node,ns);
+ }
+ return ns1;
}
-axis2c_om_attribute_t *axis2c_om_element_add_attribute(axis2c_node_t *
- element_node,
- axis2c_om_attribute_t
- * attr)
+axis2c_om_attribute_t *axis2c_om_element_add_attribute(axis2c_node_t *element_node,
+ axis2c_om_attribute_t *attr)
{
apr_status_t status;
- axis2c_qname_t *t = NULL;
+ axis2c_qname_t *qname = NULL;
axis2c_om_element_t *element = NULL;
- char *key = NULL;
-
+
if (!element_node || element_node->element_type !=AXIS2C_OM_ELEMENT)
{
- //fprintf(stderr,"Error");
- return NULL;
+ return NULL;
}
- element = (axis2c_om_element_t *) (element_node->data_element);
+ element = (axis2c_om_element_t *)(element_node->data_element);
if (!(element->attributes))
{
- if (!om_pool)
- {
- status = apr_pool_create(&om_pool, NULL);
- // error handling should go hear
- }
- element->attributes = apr_hash_make(om_pool);
+ if (!om_pool)
+ {
+ status = apr_pool_create(&om_pool, NULL);
+ }
+ element->attributes = apr_hash_make(om_pool);
}
- t = axis2c_om_attribute_get_qname(attr);
- key = axis2c_construct_key_from_qname(t);
- apr_hash_set(element->attributes, key, APR_HASH_KEY_STRING, attr);
+ qname = axis2c_om_attribute_get_qname(attr);
+
+ apr_hash_set(element->attributes, qname,sizeof(axis2c_qname_t), attr);
+
return attr;
}
-axis2c_om_attribute_t *axis2c_om_element_get_attribute(axis2c_node_t *
- element_node,
- axis2c_qname_t *
- qname)
+axis2c_om_attribute_t *axis2c_om_element_get_attribute(axis2c_node_t *element_node,
+ axis2c_qname_t *qname)
{
char *key = NULL;
axis2c_om_element_t *element = NULL;
- if (!element_node || !qname
- || element_node->element_type != AXIS2C_OM_ELEMENT)
+ if (!element_node || !qname
+ || element_node->element_type != AXIS2C_OM_ELEMENT)
{
- return NULL;
+ return NULL;
}
element = (axis2c_om_element_t *) (element_node->data_element);
- key = axis2c_construct_key_from_qname(qname);
- return (axis2c_om_attribute_t
- *) (apr_hash_get(element->attributes, key,
- APR_HASH_KEY_STRING));
-}
-
-
-
-
-static char *axis2c_construct_key_from_qname(axis2c_qname_t * qname)
-{
-
- // concatanation order is localpart prefix namespaceuri
- char *key = NULL;
- size_t i = 0;
- if (!qname)
- {
- //fprintf(stderr,"Error null value for qname ");
- return NULL;
- } else
- {
- if (qname->localpart)
- i += strlen(qname->localpart);
- if (qname->ns_uri)
- i += strlen(qname->ns_uri);
- if (qname->prefix)
- i += strlen(qname->prefix);
- key = (char *) calloc(i + 1, sizeof(char));
- if (qname->localpart)
- strcat(key, qname->localpart);
- if (qname->prefix)
- strcat(key, qname->prefix);
- if (qname->ns_uri)
- strcat(key, qname->ns_uri);
- return key;
-
- }
- return NULL;
+
+ return (axis2c_om_attribute_t *) (apr_hash_get(element->attributes, qname
+ ,sizeof(axis2c_qname_t)));
}
/*
* The node passed to the method should have the data element as of type OM_ELEMENT
-*
-*
-*
*/
-axis2c_om_attribute_t
- *axis2c_om_attribute_add_attribute_with_namespace(axis2c_node_t *
- element_node,
- const char
- *attribute_name,
- const char *value,
- axis2c_om_namespace_t
- * ns)
+axis2c_om_attribute_t *axis2c_om_element_add_attribute_with_namespace(
+ axis2c_node_t *element_node,const char *attribute_name,const char *value,
+ axis2c_om_namespace_t *ns)
{
- axis2c_om_namespace_t *t = NULL;
- if (!element_node)
+ axis2c_om_namespace_t *namespace1= NULL;
+ if (!element_node || element_node->element_type != AXIS2C_OM_ELEMENT)
{
- return NULL;
-
- } else if (element_node->element_type != AXIS2C_OM_ELEMENT)
- {
- return NULL;
+ return NULL;
}
-
-
if (ns)
{
- t = axis2c_om_element_find_namespace(element_node, ns->uri,
+ namespace1 = axis2c_om_element_find_namespace(element_node, ns->uri,
ns->prefix);
- if (t == NULL)
+ if (namespace1 == NULL)
{
- //fprintf(stderr,"prefix %s ns_uri %s This namespace is not in the scope of this element",ns->prefix,ns->uri);
return NULL;
}
}
return axis2c_om_element_add_attribute(element_node,
- axis2c_create_om_attribute
- (attribute_name, value, ns));
+ axis2c_om_attribute_create(attribute_name, value, ns));
}
-/*
-void om_element_remove_attribute(om_element_t *element,om_attribute_t *attribute)
-{
- qname_t *qname=NULL;
- char* key=NULL;
- if(!element || !(element->attributes))
- {
- // error handling
- return NULL;
- }
- qname = om_attribute_get_qname(attribute);
- if(qname)
- {
- key=construct_key_from_qname(qname);
- //apr_hash_
-
-
-
- }
-
-
-
-
-
-}
-*/
-
-void axis2c_om_element_set_namespace(axis2c_node_t * node,
- axis2c_om_namespace_t * ns)
+void axis2c_om_element_set_namespace(axis2c_node_t * node,axis2c_om_namespace_t *ns)
{
axis2c_om_namespace_t *nsp = NULL;
if (ns && node && (node->data_element))
{
- nsp = axis2c_om_element_handle_namespace(node, ns);
+ nsp = axis2c_om_element_handle_namespace(node, ns);
}
- ((axis2c_om_element_t *) node->data_element)->ns = nsp;
+ ((axis2c_om_element_t *)( node->data_element))->ns = nsp;
+ nsp = NULL;
}
@@ -450,37 +373,38 @@
{
if (element)
{
- if (element->localname)
- free(element->localname);
- if (element->ns)
- axis2c_free_om_namespace(element->ns);
- if (element->attributes)
- {
- // should find out how to free hashtable
- }
- if (element->namespaces)
- {
-
- // same as above
+ if (element->localname)
+ {
+ free(element->localname);
+ }
+ if (element->ns)
+ {
+ axis2c_om_namespace_free(element->ns);
+ }
+ if (element->attributes)
+ {
+
+ }
+ if (element->namespaces)
+ {
- }
+ }
free(element);
}
}
-void axis2c_om_element_set_localname(axis2c_node_t * element_node,
- const char *localname)
+void axis2c_om_element_set_localname(axis2c_node_t * element_node,const char *localname)
{
axis2c_om_element_t *element = NULL;
if (!element_node || element_node->element_type !=AXIS2C_OM_ELEMENT)
{
- // not correct element or null pointer
- return;
+ return;
}
element = (axis2c_om_element_t *) (element_node->data_element);
- if (element->localname)
+
+ if (element->localname)
{
- free(element->localname);
+ free(element->localname);
}
element->localname = strdup(localname);
}
@@ -491,6 +415,5 @@
{
return NULL;
}
- return strdup(((axis2c_om_element_t *) (element_node->data_element))->
- localname);
+ return ((axis2c_om_element_t *) (element_node->data_element))->localname;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_namespace.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_namespace.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_namespace.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_namespace.c Sun Oct 2 22:21:08 2005
@@ -15,36 +15,50 @@
*/
#include <axis2c_om_namespace.h>
-#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <axis2c.h>
-axis2c_om_namespace_t *axis2c_create_om_namespace(const char *uri,
+axis2c_om_namespace_t *axis2c_om_namespace_create(const char *uri,
const char *prefix)
{
- axis2c_om_namespace_t *ns =
- (axis2c_om_namespace_t *) malloc(sizeof(axis2c_om_namespace_t));
+ axis2c_om_namespace_t *ns = (axis2c_om_namespace_t *) malloc(
+ sizeof(axis2c_om_namespace_t));
if (!ns)
{
- //fprintf(stderr,"Couldnot allocate momery");
- return NULL;
+ return NULL;
}
ns->uri = strdup(uri);
ns->prefix = strdup(prefix);
+ if(!(ns->prefix) || !(ns->uri))
+ {
+ free(ns);
+ return NULL;
+ }
return ns;
}
-void axis2c_free_om_namespace(axis2c_om_namespace_t * ns)
+void axis2c_om_namespace_free(axis2c_om_namespace_t * ns)
{
if (ns)
- free(ns);
+ {
+ if(ns->prefix)
+ {
+ free(ns->prefix);
+ }
+ if(ns->uri)
+ {
+ free(ns->uri);
+ }
+ free(ns);
+ }
}
-int axis2c_om_namespace_equals(axis2c_om_namespace_t * ns1,
+boolean_t axis2c_om_namespace_equals(axis2c_om_namespace_t * ns1,
axis2c_om_namespace_t * ns2)
{
int uris_differ = 0;
@@ -54,14 +68,14 @@
return 0;
if (ns1->uri && ns2->uri)
- uris_differ = strcmp(ns1->uri, ns2->uri);
+ uris_differ = strcmp(ns1->uri, ns2->uri);
else
- uris_differ = (ns1->uri || ns2->uri);
+ uris_differ = (ns1->uri || ns2->uri);
if (ns1->prefix && ns2->prefix)
- prefixes_differ = strcmp(ns1->prefix, ns2->prefix);
+ prefixes_differ = strcmp(ns1->prefix, ns2->prefix);
else
- prefixes_differ = (ns1->prefix || ns2->prefix);
+ prefixes_differ = (ns1->prefix || ns2->prefix);
return (!uris_differ && !prefixes_differ);
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_processing_instruction.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_processing_instruction.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_processing_instruction.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_processing_instruction.c Sun Oct 2 22:21:08 2005
@@ -22,68 +22,70 @@
/**
* allocate memory for processing instruction structure and assign the values;
* This structure is set to axis2c_node_t structure and returned.
-* AXIS2C_ERROR_OM_MEMORY_ALLOCATION error is returned if malloc fails to allocate memory
-*
+*
*/
-axis2c_node_t
- *axis2c_create_om_processing_instruction_with_parent(axis2c_node_t *
- parent,
- const char
- *target,
- const char *value)
+axis2c_node_t *axis2c_create_om_processing_instruction_with_parent(
+ axis2c_node_t *parent,const char *target,const char *value)
{
axis2c_om_processing_instruction_t *pi = NULL;
- axis2c_node_t *pi_node = axis2c_create_node();
- if (pi_node)
- {
- pi = (axis2c_om_processing_instruction_t *)
- malloc(sizeof(axis2c_om_processing_instruction_t));
- if (!pi)
- {
- free(pi_node);
- fprintf(stderr, "%d error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
- return NULL;
+ axis2c_node_t *pi_node = axis2c_node_create();
+
+ if (pi_node)
+ {
+ pi = (axis2c_om_processing_instruction_t *)malloc(
+ sizeof(axis2c_om_processing_instruction_t));
+ if (!pi)
+ {
+ free(pi_node);
+ fprintf(stderr, "%d error", AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
+ }
+ if(target)
+ {
+ pi->target = strdup(target);
+ }
+ if(value)
+ {
+ pi->value = strdup(value);
+ }
}
- pi->target = strdup(target);
- pi->value = strdup(value);
- }
- pi_node->data_element = pi;
+
+ pi_node->data_element = pi;
pi_node->element_type =AXIS2C_OM_PROCESSING_INSTRUCTION;
if (parent)
{
- pi_node->parent = parent;
- axis2c_node_add_child(parent, pi_node);
+ pi_node->parent = parent;
+ axis2c_node_add_child(parent, pi_node);
}
return pi_node;
}
-axis2c_node_t *axis2c_create_empty_om_processing_instruction(axis2c_node_t
- * parent)
+axis2c_node_t *axis2c_create_empty_om_processing_instruction(axis2c_node_t *parent)
{
axis2c_node_t *pi_node = NULL;
axis2c_om_processing_instruction_t *pi = NULL;
- pi_node = axis2c_create_node();
+ pi_node = axis2c_node_create();
if (pi_node)
{
- pi = (axis2c_om_processing_instruction_t *)
- malloc(sizeof(axis2c_om_processing_instruction_t));
- if (!pi)
- {
- free(pi_node);
- return NULL;
- }
- pi->target = NULL;
- pi->value = NULL;
+ pi = (axis2c_om_processing_instruction_t *)malloc(
+ sizeof(axis2c_om_processing_instruction_t));
+ if (!pi)
+ {
+ free(pi_node);
+ return NULL;
+ }
+ pi->target = NULL;
+ pi->value = NULL;
}
- // set node type
- pi_node->data_element = pi;
+
+ pi_node->data_element = pi;
pi_node->element_type =AXIS2C_OM_PROCESSING_INSTRUCTION;
if (parent)
{
- pi_node->parent = parent;
- axis2c_node_add_child(parent, pi_node);
+ pi_node->parent = parent;
+ axis2c_node_add_child(parent, pi_node);
}
return pi_node;
}
@@ -93,11 +95,9 @@
{
if (!pi_node || pi_node->element_type !=AXIS2C_OM_PROCESSING_INSTRUCTION)
{
- // error handling
- return NULL;
+ return NULL;
}
- return ((axis2c_om_processing_instruction_t *) (pi_node->
- data_element))->value;
+ return ((axis2c_om_processing_instruction_t *)(pi_node->data_element))->value;
}
char *axis2c_om_processing_instruction_get_target(axis2c_node_t * pi_node)
@@ -106,20 +106,7 @@
{
return NULL;
}
- return ((axis2c_om_processing_instruction_t *) (pi_node->
- data_element))->target;
-}
-
-axis2c_om_processing_instruction_t
- *
-axis2c_om_processing_instruction_get_om_processing_instruction
-(axis2c_node_t * pi_node)
-{
- if (!pi_node || pi_node->element_type !=AXIS2C_OM_PROCESSING_INSTRUCTION)
- {
- return NULL;
- }
- return (axis2c_om_processing_instruction_t *) (pi_node->data_element);
+ return ((axis2c_om_processing_instruction_t *)(pi_node->data_element))->target;
}
void axis2c_om_processing_instruction_set_value(axis2c_node_t * pi_node,
@@ -128,12 +115,12 @@
axis2c_om_processing_instruction_t *pi = NULL;
if (!pi_node || pi_node->element_type !=AXIS2C_OM_PROCESSING_INSTRUCTION)
{
- return;
+ return;
}
- pi = ((axis2c_om_processing_instruction_t *) (pi_node->data_element));
+ pi = ((axis2c_om_processing_instruction_t *)(pi_node->data_element));
if (pi->value)
{
- free(pi->value);
+ free(pi->value);
}
pi->value = strdup(value);
pi = NULL;
@@ -145,12 +132,12 @@
axis2c_om_processing_instruction_t *pi = NULL;
if (!pi_node || pi_node->element_type != AXIS2C_OM_PROCESSING_INSTRUCTION)
{
- return;
+ return;
}
pi = (axis2c_om_processing_instruction_t *) (pi_node->data_element);
if (pi->target)
{
- free(pi->target);
+ free(pi->target);
}
pi->target = strdup(value);
pi = NULL;
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_text.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_text.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_text.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_om_text.c Sun Oct 2 22:21:08 2005
@@ -17,21 +17,22 @@
#include <axis2c_om_text.h>
#include <string.h>
#include <axis2c_node.h>
+#include <axis2c_errno.h>
-axis2c_node_t *axis2c_create_om_text(const char *value)
+axis2c_node_t *axis2c_create_om_text(axis2c_node_t *parent,const char *value)
{
axis2c_om_text_t *text;
- axis2c_node_t *node = axis2c_create_node();
+ axis2c_node_t *node = axis2c_node_create();
if (!node)
{
- // error handling
- return NULL;
+ fprintf(stderr,"%d Error",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
}
text = (axis2c_om_text_t *) malloc(sizeof(axis2c_om_text_t));
if (!text)
{
- // error handling
- return NULL;
+ fprintf(stderr,"%d Error",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
}
text->value = strdup(value);
text->attribute = NULL;
@@ -39,38 +40,28 @@
text->mime_type = NULL;
node->data_element = text;
node->element_type = AXIS2C_OM_TEXT;
- return node;
-}
-axis2c_node_t *axis2c_create_om_text_with_parent(axis2c_node_t * parent,
- const char *value)
-{
- axis2c_node_t *node;
- if (!parent)
- return NULL;
- node = axis2c_create_om_text(value);
- if (!node)
- {
- // error handling
- return NULL;
- }
- node->done = TRUE;
- // set parent as the parent of this text node
- node->parent = parent;
- axis2c_node_add_child(parent, node);
+ if(parent && parent->element_type == AXIS2C_OM_ELEMENT)
+ {
+ node->done = true;
+ node->parent = parent;
+ axis2c_node_add_child(parent,node);
+ }
return node;
}
+
+
char *axis2c_om_text_get_text(axis2c_om_text_t * text)
{
if (!text)
{
- // error
- return NULL;
+ return NULL;
}
if (text->value)
- return text->value;
-
+ {
+ return text->value;
+ }
else
{
//MTOM handling logic should go hear
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_qname.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_qname.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_qname.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_qname.c Sun Oct 2 22:21:08 2005
@@ -18,25 +18,79 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <axis2c_errno.h>
-
-axis2c_qname_t *axis2c_create_qname(const char *localname,
+axis2c_qname_t *axis2c_qname_create(const char *localname,
const char *ns_uri, const char *prefix)
{
axis2c_qname_t *qn = (axis2c_qname_t *) malloc(sizeof(axis2c_qname_t));
if (!qn)
{
- //fprintf(stderr,"Error allocating memory");
- return NULL;
+ fprintf(stderr," %d Error ",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
+ return NULL;
}
- qn->localpart = strdup(localname);
- qn->ns_uri = strdup(ns_uri);
- qn->prefix = strdup(prefix);
+ if(localname)
+ {
+ qn->localpart = strdup(localname);
+ }
+ if(ns_uri)
+ {
+ qn->ns_uri = strdup(ns_uri);
+ }
+ if(prefix)
+ {
+ qn->prefix = strdup(prefix);
+ }
return qn;
}
void axis2c_free_qname(axis2c_qname_t * qn)
{
- if (qn)
- free(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 axis2c_qname_equals(axis2c_qname_t *qn1,axis2c_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);
}
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2c_stax_ombuilder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2c_stax_ombuilder.c?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2c_stax_ombuilder.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2c_stax_ombuilder.c Sun Oct 2 22:21:08 2005
@@ -17,29 +17,231 @@
#include <axis2c_stax_ombuilder.h>
#include <axis2c_node.h>
#include <stdlib.h>
+#include <namespace.h>
+#include <axis2c_om_element.h>
+#include <axis2c_errno.h>
#include <xmlpullparser.h>
-/*
-stax_om_builder_t *create_stax_om_builder(XML_PullParser *parser)
+
+axis2c_stax_om_builder_t *create_stax_om_builder(XML_PullParser *parser)
{
- stax_om_builder_t *builder = (stax_om_builder_t*)malloc(sizeof(stax_om_builder_t));
+ axis2c_om_document_t *document;
+ axis2c_stax_om_builder_t *builder = (axis2c_stax_om_builder_t*)malloc(sizeof(axis2c_stax_om_builder_t));
if(!builder)
{
+ fprintf(stderr," %d Error ",AXIS2C_ERROR_OM_MEMORY_ALLOCATION);
return NULL;
}
- builder->parser = NULL;
- builder->document=NULL;
+ builder->parser = parser;
+ builder->cache = true;
+ builder->parser_accessed = false;
+ builder->done = false;
builder->lastnode=NULL;
+
+ document = axis2c_om_document_create(NULL,builder);
+ if(document)
+ {
+ builder->document = document;
+ }
return builder;
}
-axis2c_node_t *stax_om_builder_create_om_element(stax_om_builder_t *builder)
+axis2c_node_t *axis2c_stax_om_builder_create_om_element(
+ axis2c_stax_om_builder_t *builder)
+{
+ axis2c_node_t *element_node;
+ char *localname = XML_PullParser_getName(builder->parser);
+
+ if(!(builder->lastnode))
+ { /* */
+ element_node = axis2c_om_element_create_with_builder(localname,NULL,NULL,builder);
+ builder->document->root_element = element_node;
+ axis2c_om_document_add_child(builder->document,element_node);
+ }
+ else if(builder->lastnode->done)
+ { /* */
+ element_node = axis2c_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 = axis2c_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;
+}
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_comment(
+ axis2c_stax_om_builder_t *builder)
+{
+ axis2c_node_t *node;
+ if(!builder)
+ {
+ return NULL;
+ }
+ /*****/
+ return NULL;
+}
+
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_doctype(
+ axis2c_stax_om_builder_t *builder)
+{
+ /******/
+}
+
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_processing_instruction(
+ axis2c_stax_om_builder_t *builder)
+{
+ /******/
+
+
+
+
+
+}
+
+void axis2c_stax_om_builder_end_element(axis2c_stax_om_builder_t *builder)
+{
+ axis2c_node_t *parent;
+ if(builder->lastnode->done)
+ {
+ parent = builder->lastnode->parent;
+ parent->done = true;
+ builder->lastnode = parent;
+ }
+ else
+ {
+ builder->lastnode->done = true;
+ }
+}
+
+
+int axis2c_stax_om_builder_next(axis2c_stax_om_builder_t *builder)
{
- axis2c_node_t *om_element;
+ 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 = axis2c_stax_om_builder_create_om_element(builder);
+ }
+ break;
+ case END_ELEMENT:
+ {
+
+
+
+
+ }
+ break;
+ case CHARACTER:
+ {
+
+
+
+
+ }
+ break;
+ case COMMENT:
+ {
+
+
+
+
+
+
+ }
+ break;
+ };
+}
+void axis2c_stax_om_builder_process_attributes(axis2c_stax_om_builder_t *builder,axis2c_node_t *element_node)
+{
+}
+
+
+axis2c_node_t *axis2c_stax_om_builder_create_om_text(axis2c_stax_om_builder_t *builder)
+{
+}
+
+
+void axis2c_stax_om_builder_discard(axis2c_stax_om_builder_t *builder,axis2c_node_t *element_node)
+{
}
-*/
+
+axis2c_node_t *axis2c_stax_om_builder_process_namespace_data(axis2c_stax_om_builder_t *builder,axis2c_node_t *element,int is_soap_element)
+{
+ int i=0;
+ char *nsuri = NULL;
+ char *prefix = NULL;
+ NAMESPACE *NS;
+ axis2c_om_namespace_t *ns,*ns1;
+ int namespace_count = XML_PullParser_getNamespaceCount (builder->parser);
+ for( i = 0 ; i < namespace_count ; i++)
+ {
+ axis2c_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 = axis2c_om_element_find_namespace(element,nsuri,"");
+ if(!ns)
+ {
+ ns = axis2c_om_element_declare_namespace_with_ns_uri_prefix(element,nsuri,"");
+ }
+ if(((axis2c_om_element_t*)element)->ns == ns)
+ {
+ axis2c_om_element_set_namespace(element,ns);
+ }
+ }
+ else
+ {
+ ns = axis2c_om_element_find_namespace(element,nsuri,prefix);
+ if(!ns)
+ {
+ ns1 = axis2c_om_namespace_create(nsuri,prefix);
+ axis2c_om_element_set_namespace(element,ns);
+ }
+ else
+ {
+ axis2c_om_element_set_namespace(element,ns);
+ }
+ }
+ }
+}
Modified: webservices/axis2/trunk/c/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/project.properties?rev=293252&r1=293251&r2=293252&view=diff
==============================================================================
--- webservices/axis2/trunk/c/project.properties (original)
+++ webservices/axis2/trunk/c/project.properties Sun Oct 2 22:21:08 2005
@@ -19,6 +19,6 @@
freehep.nar.c.compiler=gcc
freehep.nar.c.linker=gcc
freehep.nar.c.compiler.arg.mid=-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread
-freehep.nar.compile.includepath=${axis2c.include}/include ${cutest.home}/include/ ${apr.home}/include/apr-1 /home/samisa/axis2/c/modules/xml/guththila/src/
+freehep.nar.compile.includepath=${axis2c.include}/include ${cutest.home}/include/ ${apr.home}/include/apr-1 ../../../modules/xml/guththila/src/
#freehep.nar.tests=om_test
freehep.nar.linker.test.arg.mid=-L${cutest.home}/lib/ -lcutest -L${apr.home}/lib -lapr-1