You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by sh...@apache.org on 2010/04/01 16:07:15 UTC

svn commit: r929982 [1/3] - in /axis/axis2/c/core/trunk: axiom/include/ axiom/src/om/ util/include/ util/src/

Author: shankar
Date: Thu Apr  1 14:07:15 2010
New Revision: 929982

URL: http://svn.apache.org/viewvc?rev=929982&view=rev
Log:
Refactor, adding comments, improving performance

Added:
    axis/axis2/c/core/trunk/axiom/src/om/axiom_element_internal.h
Modified:
    axis/axis2/c/core/trunk/axiom/include/axiom_element.h
    axis/axis2/c/core/trunk/axiom/src/om/om_attribute.c
    axis/axis2/c/core/trunk/axiom/src/om/om_element.c
    axis/axis2/c/core/trunk/axiom/src/om/om_namespace.c
    axis/axis2/c/core/trunk/axiom/src/om/om_node.c
    axis/axis2/c/core/trunk/axiom/src/om/om_stax_builder.c
    axis/axis2/c/core/trunk/util/include/axutil_utils.h
    axis/axis2/c/core/trunk/util/src/qname.c

Modified: axis/axis2/c/core/trunk/axiom/include/axiom_element.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/include/axiom_element.h?rev=929982&r1=929981&r2=929982&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/include/axiom_element.h (original)
+++ axis/axis2/c/core/trunk/axiom/include/axiom_element.h Thu Apr  1 14:07:15 2010
@@ -43,22 +43,20 @@ extern "C"
      */
 
     /**
-      * Creates an AXIOM element with given local name
-      * @param env Environment. MUST NOT be NULL.
-      * @param parent parent of the element node to be created. can be NULL.
-      * @param localname local name of the elment. cannot be NULL.
-      * @param ns namespace of the element.  can be NULL.
-      *                       If the value of the namespace has not already been declared
-      *                       then the namespace structure ns will be declared and will be
-      *                       freed when the tree is freed.
-      *                       If the value of the namespace has already been declared using
-      *                       another namespace structure then the namespace structure ns
-      *                       will be freed.
-      * @param node This is an out parameter. cannot be NULL.
-      *                       Returns the node corresponding to the comment created.
-      *                       Node type will be set to AXIOM_ELEMENT
-      * @return a pointer to the newly created element struct
-      */
+     * Creates an AXIOM element with given local name
+     * @param env Environment. MUST NOT be NULL.
+     * @param parent parent of the element node to be created. can be NULL.
+     * @param localname local name of the element. cannot be NULL.
+     * @param ns namespace of the element.  can be NULL.
+     *                       If the value of the namespace has not already been declared
+     *                       then the namespace structure ns will be cloned and declared and will be
+     *                       freed when the tree is freed.
+     *                       Caller has to delete the original ns object passed to the method.
+     * @param node This is an out parameter. cannot be NULL.
+     *                       Returns the node corresponding to the comment created.
+     *                       Node type will be set to AXIOM_ELEMENT
+     * @return a pointer to the newly created element struct
+     */
     AXIS2_EXTERN axiom_element_t *AXIS2_CALL
     axiom_element_create(
         const axutil_env_t * env,
@@ -83,11 +81,37 @@ extern "C"
         axiom_node_t * parent,
         const axutil_qname_t * qname,
         axiom_node_t ** node);
-    /*
+
+    /**
+     * Frees given element
+     * @param element AXIOM element to be freed.
+     * @param env Environment. MUST NOT be NULL.
+     * @return status of the operation. AXIS2_SUCCESS on success ,AXIS2_FAILURE on error.
+     */
+    AXIS2_EXTERN void AXIS2_CALL
+    axiom_element_free(
+        axiom_element_t * element,
+        const axutil_env_t * env);
+
+    /**
+     * finds a namespace in current element's scope, by uri or prefix or both
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param uri namespace uri, may be null
+     * @param prefix prefix
+     * @return axiom_namespace_t if found, else return NULL
+     */
+    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
+    axiom_element_find_declared_namespace(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        const axis2_char_t * uri,
+        const axis2_char_t * prefix);
+
+    /**
      * Find a namespace in the scope of the document.
      * Start to find from the given node and go up the hierarchy.
-     * @param om_element pointer to om_element_struct contained in
-     *        node , 
+     * @param om_element pointer to om_element_struct contained in node ,
      * @param env Environment. MUST NOT be NULL.
      * @param node node containing an instance of an AXIOM element,cannot be NULL.
      * @param uri namespace uri..
@@ -104,41 +128,12 @@ extern "C"
         const axis2_char_t * prefix);
 
     /**
-      * Declare a namespace in current element (in the scope of this element ).
-      * It checks to see if it is already declared.
-      * @param om_element contained in the om node struct
-      * @param env Environment. MUST NOT be NULL.
-      * @param node node containing an instance of an AXIOM element.
-      * @param ns pointer to the namespace struct to be declared
-      * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE.
-      */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_declare_namespace(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axiom_node_t * node,
-        axiom_namespace_t * ns);
-    /**
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE.
-     *
-     */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_declare_namespace_assume_param_ownership(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axiom_namespace_t * ns);
-
-    /**
-     * Finds a namespace using qname
-     * Start to find from the given node and go up the hierarchy.
+     * Finds a namespace using qname. Start to find from the given node and go up the hierarchy.
      * @param om_element om_element contained in node
      * @param env Environment. MUST NOT be NULL.
-     * @param node node containing an instance of an AXIOM element, cannot be NULL.   
+     * @param node node containing an instance of an AXIOM element, cannot be NULL.
      * @param qname qname of the namespace to be found. cannot be NULL.
-     * @return pointer to the namespace, if found, else NULL. On error, returns 
+     * @return pointer to the namespace, if found, else NULL. On error, returns
      *           NULL and sets the error code in environment's error struct.
      */
     AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
@@ -149,211 +144,212 @@ extern "C"
         axutil_qname_t * qname);
 
     /**
-      * Adds an attribute to current element The current element takes responsibility of the assigned attribute
-      * @param om_element element to which the attribute is to be added.cannot be NULL.
+      * Declare a namespace in current element (in the scope of this element ).
+      * It checks to see if it is already declared at this level or in its ancestors
+      * @param om_element contained in the om node struct
       * @param env Environment. MUST NOT be NULL.
-      * @param attribute attribute to be added.
-      * @param node axiom_node_t node that om_element is contained in
-      * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE.
+      * @param node node containing an instance of an AXIOM element.
+      * @param ns pointer to the namespace struct to be declared. Should not be null
+      * @return status of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE.
       */
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_add_attribute(
+    axiom_element_declare_namespace(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_attribute_t * attribute,
-        axiom_node_t * node);
+        axiom_node_t * node,
+        axiom_namespace_t * ns);
 
     /**
-      * Gets (finds) the attribute with the given qname
-      * @param element element whose attribute is to be found. 
-      * @param env Environment. MUST NOT be NULL.
-      * @qname qname qname of the attribute to be found. should not be NULL.
-      * @return a pointer to the attribute with given qname if found, else NULL.
-      *           On error, returns NULL and sets the error code in environment's error struct.
-      */
-    AXIS2_EXTERN axiom_attribute_t *AXIS2_CALL
-    axiom_element_get_attribute(
+     * get the namespace  of om_element
+     * @param om_element om_element struct
+     * @param env environment, MUST NOT be NULL.
+     * @returns pointer to axiom_namespace_t struct
+     *          NULL if there is no namespace associated with the element,
+     *          NULL on error with error code set to environment's error
+     */
+    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
+    axiom_element_get_namespace(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axutil_qname_t * qname);
+        axiom_node_t * ele_node);
 
     /**
-    * Gets (finds) the attribute value with the given qname
-    * @param element element whose attribute is to be found. 
-    * @param env Environment. MUST NOT be NULL.
-    * @qname qname qname of the attribute to be found. should not be NULL.
-    * @return the attribute value with given qname if found, else NULL.
-    *  On error, returns NULL and sets the error code in environment's error struct.
-    */
-    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-    axiom_element_get_attribute_value(
+     * set the namespace of the element
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param ns pointer to namespace. Must not be NULL
+     *                       If the value of the namespace has not already been declared
+     *                       then the namespace structure ns will be declared and will be
+     *                       freed when the tree is freed.
+     * @returns status code of the op, with error code
+     *                  set to environment's error
+     */
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_set_namespace(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axutil_qname_t * qname);
+        axiom_namespace_t * ns,
+        axiom_node_t * node);
 
     /**
-      * Frees given element 
-      * @param element AXIOM element to be freed.
-      * @param env Environment. MUST NOT be NULL.
-       * @return satus of the op. AXIS2_SUCCESS on success ,AXIS2_FAILURE on error.
-      */
-    AXIS2_EXTERN void AXIS2_CALL
-    axiom_element_free(
-        axiom_element_t * element,
+     * get the namespace list of the element
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @returns axutil_hash pointer to namespaces hash
+     * this hash table is read only
+     */
+    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+    axiom_element_get_namespaces(
+        axiom_element_t * om_element,
         const axutil_env_t * env);
 
     /**
-      * Serializes the start part of the given element
-      * @param element element to be serialized.
-      * @param env Environment. MUST NOT be NULL.
-      * @param om_output AXIOM output handler to be used in serializing
-      * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE
-      */
+     * Adds an attribute to current element. The current element takes responsibility of the
+     * assigned attribute
+     * @param om_element element to which the attribute is to be added.cannot be NULL.
+     * @param env Environment. MUST NOT be NULL.
+     * @param attribute attribute to be added.
+     * @param node axiom_node_t node that om_element is contained in
+     * @return status of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE.
+     */
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_serialize_start_part(
+    axiom_element_add_attribute(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_output_t * om_output,
-        axiom_node_t * ele_node);
+        axiom_attribute_t * attribute,
+        axiom_node_t * node);
 
     /**
-     * Serializes the end part of the given element. serialize_start_part must 
-     *     have been called before calling this method.
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     * @param om_output AXIOM output handler to be used in serializing
-     * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE
+     * Gets (finds) the attribute with the given qname
+     * @param element element whose attribute is to be found.
+     * @param env Environment. MUST NOT be NULL.
+     * @qname qname qname of the attribute to be found. should not be NULL.
+     * @return a pointer to the attribute with given qname if found, else NULL.
+     *           On error, returns NULL and sets the error code in environment's error struct.
      */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_serialize_end_part(
+    AXIS2_EXTERN axiom_attribute_t *AXIS2_CALL
+    axiom_element_get_attribute(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_output_t * om_output);
+        axutil_qname_t * qname);
 
     /**
-     * finds a namespace in current element's scope, 
-     *     by uri or prefix or both
+     * get  the attribute list of the element
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param uri namespace uri, may be null
-     * @param prefix prefix 
-     * @return axiom_namespace_t if found, else return NULL
+     * @returns axutil_hash pointer to attributes hash
+     * This hash table is read only
      */
-
-    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
-    axiom_element_find_declared_namespace(
+    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+    axiom_element_get_all_attributes(
         axiom_element_t * om_element,
-        const axutil_env_t * env,
-        const axis2_char_t * uri,
-        const axis2_char_t * prefix);
+        const axutil_env_t * env);
 
     /**
-     * returns the localname of this element
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @returns localname of element, returns NULL on error.
+     * Gets (finds) the attribute value with the given qname
+     * @param element element whose attribute is to be found.
+     * @param env Environment. MUST NOT be NULL.
+     * @qname qname qname of the attribute to be found. should not be NULL.
+     * @return the attribute value with given qname if found, else NULL.
+     *  On error, returns NULL and sets the error code in environment's error struct.
      */
     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-    axiom_element_get_localname(
+    axiom_element_get_attribute_value(
         axiom_element_t * om_element,
-        const axutil_env_t * env);
+        const axutil_env_t * env,
+        axutil_qname_t * qname);
 
     /**
-     * set the localname of this element
+     *  Extract attributes , returns a clones hash table of attributes,
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @localname text value to be set as localname 
-     * @returns status code of op, AXIS2_SUCCESS on success,
-     *                   AXIS2_FAILURE on error.
+     * @param om_node pointer to this element node
      */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_set_localname(
+    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+    axiom_element_extract_attributes(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        const axis2_char_t * localname);
+        axiom_node_t * ele_node);
 
     /**
-     * get the namespace  of om_element 
-     * @param om_element om_element struct
-     * @param env environemt, MUST NOT be NULL.
-     * @returns pointer to axiom_namespace_t struct 
-     *          NULL if there is no namespace associated with the element,
-     *          NULL on error with error code set to environment's error
+     * Returns the attribute value as a string for the given element
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param attr_name the attribute name
+     * @return the attribute value as a string
      */
-    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
-    axiom_element_get_namespace(
-        axiom_element_t * om_element,
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    axiom_element_get_attribute_value_by_name(
+        axiom_element_t * om_ele,
         const axutil_env_t * env,
-        axiom_node_t * ele_node);
+        axis2_char_t * attr_name);
 
     /**
-     * set the namespace of the element
+     * Select all the text children and concatenate them to a single string. The string
+     * returned by this method call will be free by axiom when this method is called again.
+     * So it is recommended to have a copy of the return value if this method is going to
+     * be called more that once and the return values of the earlier calls are important.
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param ns pointer to namespace
-     *                       If the value of the namespace has not already been declared
-     *                       then the namespace structure ns will be declared and will be 
-     *                       freed when the tree is freed.
-     * @returns status code of the op, with error code 
-     *                  set to environment's error
+     * @param element node , the container node of this om element
+     * @return the concatenated text of all text children text values
+     *         return null if no text children is available or on error
      */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_set_namespace(
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    axiom_element_get_text(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_namespace_t * ns,
-        axiom_node_t * node);
-
+        axiom_node_t * element_node);
 
     /**
-     * unconditionally set the namespace of the element
+     * Sets the text of the given element.
+     * caution - This method will wipe out all the text elements (and hence any mixed content)
+     * before setting the text
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param ns pointer to namespace
-     *                       The namespace ns is assumed to have been declared already.
-     * @returns status code of the op, with error code
-     *                  set to environment's error
+     * @param text text to set.
+     * @param element_node node of element.
+     * @return AXIS2_SUCCESS if attribute was found and removed, else
+     *           AXIS2_FAILURE
      */
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_set_namespace_assume_param_ownership(
+    axiom_element_set_text(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_namespace_t * ns);
+        const axis2_char_t * text,
+        axiom_node_t * element_node);
 
     /**
-     * get  the attribute list of the element 
+     * returns the localname of this element
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @returns axutil_hash poiner to attributes hash
-     * This hash table is read only 
+     * @returns localname of element, returns NULL on error.
      */
-    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
-    axiom_element_get_all_attributes(
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    axiom_element_get_localname(
         axiom_element_t * om_element,
         const axutil_env_t * env);
 
     /**
-     * get the namespace list of the element
+     * set the localname of this element
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @returns axutil_hash pointer to namespaces hash
-     * this hash table is read only
+     * @localname text value to be set as localname
+     * @returns status code of operation, AXIS2_SUCCESS on success,
+     *                   AXIS2_FAILURE on error.
      */
-    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
-    axiom_element_get_namespaces(
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_set_localname(
         axiom_element_t * om_element,
-        const axutil_env_t * env);
+        const axutil_env_t * env,
+        const axis2_char_t * localname);
 
     /**
-     *@return qname of this element
-     * the returned qname should not be externaly freed
-     * when om_element struct is freed qname is also
-     * freed 
+     * return qname of this element. The returned qname should not be freed by the caller.
+     * It will be freed when om_element struct is freed
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
      * @param ele_node pointer to this element node
-     *
      * @returns axutil_qname_t struct , NULL on failure
      */
     AXIS2_EXTERN axutil_qname_t *AXIS2_CALL
@@ -363,14 +359,11 @@ extern "C"
         axiom_node_t * ele_node);
 
     /**
-     *   returns a list of children iterator
-     *   returned iterator is freed when om_element struct
-     *   is freed
-     *   iterators reset function must be called by user
+     * returns a list of children iterator. Returned iterator is freed when om_element struct
+     * is freed.
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
      * @param element_node pointer to this element node
-     *
      */
     AXIS2_EXTERN axiom_children_iterator_t *AXIS2_CALL
     axiom_element_get_children(
@@ -379,15 +372,13 @@ extern "C"
         axiom_node_t * element_node);
 
     /**
-     *   returns a list of children iterator with qname
-     *   returned iterator is freed when om element struct
-     *  is freed 
+     * returns a list of children iterator with qname. Returned iterator is freed when om element
+     * struct is freed
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
      * @param element_node pointer to this element node
      * @returns children qname iterator struct
      */
-
     AXIS2_EXTERN axiom_children_qname_iterator_t *AXIS2_CALL
     axiom_element_get_children_with_qname(
         axiom_element_t * om_element,
@@ -396,16 +387,15 @@ extern "C"
         axiom_node_t * element_node);
 
     /**
-     * Returns the om_element corresponding to element_qname
+     * Returns the first om_element corresponding to element_qname
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param element_qname qname of the element 
+     * @param element_qname qname of the element
      * @param om_node pointer to this element node
-     * @param element_node 
-     * @param child_node 
+     * @param element_node
+     * @param child_node
      * @returns children qname iterator struct
      */
-
     AXIS2_EXTERN axiom_element_t *AXIS2_CALL
     axiom_element_get_first_child_with_qname(
         axiom_element_t * om_element,
@@ -415,62 +405,11 @@ extern "C"
         axiom_node_t ** child_node);
 
     /**
-     * removes an attribute from the element attribute list
-     * user must free this attribute, element free function does not free 
-     * attributes that are not is it's attribute list
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param om_attribute attribute to be removed
-     * @return AXIS2_SUCCESS if attribute was found and removed, else 
-     *           AXIS2_FAILURE
-     */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_remove_attribute(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axiom_attribute_t * om_attribute);
-
-    /**
-     * Sets the text of the given element.
-     * caution - This method will wipe out all the text elements (and hence any
-     * mixed content) before setting the text
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param text text to set.
-     * @param element_node node of element.
-     * @return AXIS2_SUCCESS if attribute was found and removed, else 
-     *           AXIS2_FAILURE
-     */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_set_text(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        const axis2_char_t * text,
-        axiom_node_t * element_node);
-
-    /**
-     * Select all the text children and concatenate them to a single string. The string
-	 * returned by this method call will be free by axiom when this method is called again. 
-	 * So it is recommended to have a copy of the return value if this method is going to
-	 * be called more that once and the return values of the earlier calls are important.
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param element node , the container node of this om element
-     * @return the concatenated text of all text children text values
-     *         return null if no text children is available or on error
-     */
-    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-    axiom_element_get_text(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axiom_node_t * element_node);
-
-    /**
      * returns the first child om element of this om element node
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
      * @param om_node pointer to this element node
-     * @return om_element if one is availble otherwise return NULL
+     * @return om_element if one is available otherwise return NULL
      */
     AXIS2_EXTERN axiom_element_t *AXIS2_CALL
     axiom_element_get_first_element(
@@ -480,84 +419,88 @@ extern "C"
         axiom_node_t ** first_element_node);
 
     /**
-     * returns the serilized text of this element and its children
+     * returns an iterator with child elements of type AXIOM_ELEMENT
+     * iterator is freed when om_element node is freed
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param element_node the container node this on element is contained 
-     * @return a char array of xml , returns NULL on error
+     * @param element_node
+     * @returns axiom_child_element_iterator_t , NULL on error
      */
-    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-    axiom_element_to_string(
+    AXIS2_EXTERN axiom_child_element_iterator_t *AXIS2_CALL
+    axiom_element_get_child_elements(
         axiom_element_t * om_element,
         const axutil_env_t * env,
         axiom_node_t * element_node);
 
+#if 0
     /**
-     * returns an iterator with child elements of type AXIOM_ELEMENT
-     * iterator is freed when om_element node is freed
+     * builds this om_element_node completely, This is only possible
+     * if the om_stax_builder is associated with the om_element_node,
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param element_node
-     * @returns axiom_child_element_iterator_t , NULL on error    
+     * @param om_node pointer to this element node
+     * @param element_node corresponding om element node of this om element
+     * struct
+     * @returns AXIS2_SUCCESS if this element node was successfully completed,
+     * otherwise returns AXIS2_FAILURE
      */
-    AXIS2_EXTERN axiom_child_element_iterator_t *AXIS2_CALL
-    axiom_element_get_child_elements(
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_build(
         axiom_element_t * om_element,
         const axutil_env_t * env,
         axiom_node_t * element_node);
 
-
-
     /**
-     * retrieves the default namespace of this element , if available,
-     * @param om_element pointer to om element
-     * @param env axutil_environment MUST Not be NULL
-     * @param element_node corresponding om element node of this om element
-     * @returns pointer to default namespace if availale , NULL otherwise
+     * checks for the namespace in the context of this element
+     * with the given prefix
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param om_element_node pointer to this element node
+     * @returns pointer to relevent namespace
      */
     AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
-    axiom_element_get_default_namespace(
+    axiom_element_find_namespace_uri(
         axiom_element_t * om_element,
         const axutil_env_t * env,
+        const axis2_char_t * prefix,
         axiom_node_t * element_node);
 
     /**
-     * declared a default namespace explicitly 
-     * @param om_element pointer to om element
+     * Returns the Local name of the element
+     * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param uri namespace uri of the default namespace
-     * @returns the declared namespace
-                                                 */
-    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
-    axiom_element_declare_default_namespace(
+     * @param om_node pointer to this element node
+     *
+     * @return the Local name of the element
+     */
+    AXIS2_EXTERN axutil_string_t *AXIS2_CALL
+    axiom_element_get_localname_str(
         axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axis2_char_t * uri);
+        const axutil_env_t * env);
 
     /**
-     * checks for the namespace in the context of this element 
-     * with the given prefix 
+     * Set the Local name of the element
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param om_element_node pointer to this element node
-     * @returns pointer to relevent namespace 
+     * @param localname  the Local name of the element
+     *
+     * @return
      */
-    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
-    axiom_element_find_namespace_uri(
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_set_localname_str(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        const axis2_char_t * prefix,
-        axiom_node_t * element_node);
+        axutil_string_t * localname);
 
     /**
-     *This will not search the namespace in the scope nor will 
+     *This will not search the namespace in the scope nor will
      * declare in the current element, as in set_namespace. This will
      * just assign the given namespace to the element.
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
      * @param om_node pointer to this element node
      * @param om_ns pointer to namespace to be set
-     * @returns 
+     * @returns
      */
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
     axiom_element_set_namespace_with_no_find_in_current_scope(
@@ -566,32 +509,45 @@ extern "C"
         axiom_namespace_t * om_ns);
 
     /**
-     *  Extract attributes , returns a clones hash table of attributes,
-     *  if attributes are associated with a namespace it is also cloned
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
      * @param om_node pointer to this element node
+     * @return satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE.
      *
      */
-    AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
-    axiom_element_extract_attributes(
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_declare_namespace_assume_param_ownership(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_node_t * ele_node);
+        axiom_namespace_t * ns);
 
     /**
-     * Returns the attribute value as a string for the given element
+     * unconditionally set the namespace of the element
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param attr_name the attribute name
-     * 
-     * @return the attribute value as a string
+     * @param ns pointer to namespace
+     *                       The namespace ns is assumed to have been declared already.
+     * @returns status code of the op, with error code
+     *                  set to environment's error
      */
-    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-    axiom_element_get_attribute_value_by_name(
-        axiom_element_t * om_ele,
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_set_namespace_assume_param_ownership(
+        axiom_element_t * om_element,
         const axutil_env_t * env,
-        axis2_char_t * attr_name);
+        axiom_namespace_t * ns);
+
+    /**
+     * declared a default namespace explicitly
+     * @param om_element pointer to om element
+     * @param env environment MUST not be NULL
+     * @param uri namespace uri of the default namespace
+     * @returns the declared namespace
+     */
+    AXIS2_EXTERN axiom_namespace_t *AXIS2_CALL
+    axiom_element_declare_default_namespace(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axis2_char_t * uri);
 
     /**
      * Create an OM Element and an OM node from given string params
@@ -600,7 +556,7 @@ extern "C"
      * @param localname the locanmae of the element
      * @param ns the namespace of the element
      * @param node the reference ot the created node
-     * @return 
+     * @return
      */
     AXIS2_EXTERN axiom_element_t *AXIS2_CALL
     axiom_element_create_str(
@@ -611,37 +567,10 @@ extern "C"
         axiom_node_t ** node);
 
     /**
-     * Returns the Local name of the element
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     * 
-     * @return the Local name of the element
-     */
-    AXIS2_EXTERN axutil_string_t *AXIS2_CALL
-    axiom_element_get_localname_str(
-        axiom_element_t * om_element,
-        const axutil_env_t * env);
-
-    /**
-     * Set the Local name of the element
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param localname  the Local name of the element 
-     * 
-     * @return
-     */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_set_localname_str(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axutil_string_t * localname);
-
-    /**
      * Return whether the element is empty or not
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * 
+     *
      * @return AXIS2_TRUE if empty AXIS2_FALSE if not empty
      */
     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
@@ -650,97 +579,33 @@ extern "C"
         const axutil_env_t * env);
 
     /**
-     * Set whether the element is empty or not
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param is_empty AXIS2_TRUE if empty AXIS2_FALSE if not empty
-     * 
-     * @return VOID
-     */
-    AXIS2_EXTERN void AXIS2_CALL
-    axiom_element_set_is_empty(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axis2_bool_t is_empty);
-
-    /**
-     * Collect all the namespaces with distinct prefixes in 
-     * the parents of the given element.  Effectively this 
-     * is the set of namespaces declared above this element  
-     * that are inscope at this element and might be used   
-     * by it or its children. 
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     * @returns pointer to hash of relevent namespaces
-     */
-    AXIS2_EXTERN axutil_hash_t * AXIS2_CALL
-    axiom_element_gather_parent_namespaces(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axiom_node_t * om_node);
-
-    /**
-     * If the provided namespace used by the provided element 
-     * is one of the namespaces from the parent of the root  
-     * root element, redeclares that namespace at the root element
-     * and removes it from the hash of parent namespaces
-     * @param om_element pointer to om_element
-     * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     * @param ns pointer to namespace to redeclare
-     * @param root_element pointer to the subtree root element node
-     * @param inscope_namespaces pointer to hash of parent namespaces
-     */
-    AXIS2_EXTERN void AXIS2_CALL
-    axiom_element_use_parent_namespace(
-        axiom_element_t * om_element,
-        const axutil_env_t * env,
-        axiom_node_t * om_node,
-        axiom_namespace_t *ns,
-        axiom_element_t * root_element,
-        axutil_hash_t *inscope_namespaces);
-
-    /**
-     * Examines the subtree beginning at the provided element 
-     * For each element or attribute, if it refers to a namespace   
-     * declared in a parent of the subtree root element, redeclares
-     * that namespace at the level of the subtree root and removes
-     * it from the set of parent namespaces in scope and not yet 
-     * declared
+     * removes an attribute from the element attribute list
+     * user must free this attribute, element free function does not free
+     * attributes that are not is it's attribute list
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     *
-     * @param root_element pointer to the subtree root element node
-     * @param inscope_namespaces pointer to hash of parent namespaces
+     * @param om_attribute attribute to be removed
+     * @return AXIS2_SUCCESS if attribute was found and removed, else
+     *           AXIS2_FAILURE
      */
-    AXIS2_EXTERN void AXIS2_CALL
-    axiom_element_redeclare_parent_namespaces(
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_element_remove_attribute(
         axiom_element_t * om_element,
         const axutil_env_t * env,
-        axiom_node_t * om_node,
-        axiom_element_t * root_element,
-        axutil_hash_t *inscope_namespaces);
+        axiom_attribute_t * om_attribute);
 
-#if 0
     /**
-     * builds this om_element_node completely, This is only possible
-     * if the om_stax_builder is associated with the om_element_node,
+     * returns the serilized text of this element and its children
      * @param om_element pointer to om_element
      * @param env environment MUST not be NULL
-     * @param om_node pointer to this element node
-     * @param element_node corresponding om element node of this om element
-     * struct
-     * @returns AXIS2_SUCCESS if this element node was successfully completed,
-     * otherwise returns AXIS2_FAILURE
+     * @param element_node the container node this on element is contained
+     * @return a char array of xml , returns NULL on error
      */
-    AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    axiom_element_build(
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    axiom_element_to_string(
         axiom_element_t * om_element,
         const axutil_env_t * env,
         axiom_node_t * element_node);
-
 #endif
     /** @} */
 

Added: axis/axis2/c/core/trunk/axiom/src/om/axiom_element_internal.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/axiom_element_internal.h?rev=929982&view=auto
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/axiom_element_internal.h (added)
+++ axis/axis2/c/core/trunk/axiom/src/om/axiom_element_internal.h Thu Apr  1 14:07:15 2010
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIOM_ELEMENT_INTERNAL_H_
+#define AXIOM_ELEMENT_INTERNAL_H_
+
+/** @defgroup axiom AXIOM (Axis Object Model)
+ * @ingroup axis2
+ * @{
+ */
+
+/** @} */
+
+#include <axiom_element.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /**
+     * @defgroup axiom_element element
+     * @ingroup axiom
+     * @{
+     */
+
+    /**
+     * Collect all the namespaces with distinct prefixes in the parents of the given element.
+     * Effectively this is the set of namespaces declared above this element that are inscope at
+     * this element and might be used by it or its children.
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param om_node pointer to this element node
+     * @returns pointer to hash of relevant namespaces
+     */
+    axutil_hash_t * AXIS2_CALL
+    axiom_element_gather_parent_namespaces(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axiom_node_t * om_node);
+
+    /**
+     * Examines the subtree beginning at the provided element for each element or attribute,
+     * if it refers to a namespace declared in a parent of the subtree root element, if not already
+     * declared, redeclares that namespace at the level of the subtree root and removes
+     * it from the set of parent inscope_namespaces. inscope_namespaces contains all the parent
+     * namespaces which should be redeclared at some point.
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param om_node pointer to this element node
+     * @param inscope_namespaces pointer to hash of parent namespaces
+     */
+    void AXIS2_CALL
+    axiom_element_redeclare_parent_namespaces(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axiom_node_t * om_node,
+        axutil_hash_t *inscope_namespaces);
+
+    /**
+     * If the provided namespace used by the provided element is one of the namespaces from the
+     * parent of the root element, redeclares that namespace at the root element and removes it
+     * from the hash of parent namespaces
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param om_node pointer to this element node
+     * @param ns pointer to namespace to redeclare
+     * @param inscope_namespaces pointer to hash of parent namespaces
+     */
+    void AXIS2_CALL
+    axiom_element_use_parent_namespace(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axiom_node_t * om_node,
+        axiom_namespace_t *ns,
+        axutil_hash_t *inscope_namespaces);
+
+    /**
+     * retrieves the default namespace of this element
+     * @param om_element pointer to om element
+     * @param env axutil_environment MUST Not be NULL
+     * @param element_node corresponding om element node of this om element
+     * @returns pointer to default namespace if available , NULL otherwise
+     */
+    axiom_namespace_t *AXIS2_CALL
+    axiom_element_get_default_namespace(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axiom_node_t * element_node);
+
+    /**
+     * Serializes the start part of the given element
+     * @param element element to be serialized.
+     * @param env Environment. MUST NOT be NULL.
+     * @param om_output AXIOM output handler to be used in serializing
+     * @return status of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+     */
+    axis2_status_t AXIS2_CALL
+    axiom_element_serialize_start_part(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axiom_output_t * om_output,
+        axiom_node_t * ele_node);
+
+    /**
+     * Serializes the end part of the given element. serialize_start_part must
+     *     have been called before calling this method.
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param om_node pointer to this element node
+     * @param om_output AXIOM output handler to be used in serializing
+     * @return status of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+     */
+    axis2_status_t AXIS2_CALL
+    axiom_element_serialize_end_part(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axiom_output_t * om_output);
+
+    /**
+     * Set whether the element is empty or not
+     * @param om_element pointer to om_element
+     * @param env environment MUST not be NULL
+     * @param is_empty AXIS2_TRUE if empty AXIS2_FALSE if not empty
+     * @return VOID
+     */
+    void AXIS2_CALL
+    axiom_element_set_is_empty(
+        axiom_element_t * om_element,
+        const axutil_env_t * env,
+        axis2_bool_t is_empty);
+
+#endif /* AXIOM_ELEMENT_INTERNAL_H_ */

Modified: axis/axis2/c/core/trunk/axiom/src/om/om_attribute.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/src/om/om_attribute.c?rev=929982&r1=929981&r2=929982&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/src/om/om_attribute.c (original)
+++ axis/axis2/c/core/trunk/axiom/src/om/om_attribute.c Thu Apr  1 14:07:15 2010
@@ -201,11 +201,9 @@ axiom_attribute_get_localname(
     axiom_attribute_t * attribute,
     const axutil_env_t * env)
 {
-    if(attribute->localname)
-    {
-        return (axis2_char_t *)axutil_string_get_buffer(attribute->localname, env);
-    }
-    return NULL;
+    AXIS2_ASSERT(attribute);
+    AXIS2_ASSERT(attribute->localname);
+    return (axis2_char_t *)axutil_string_get_buffer(attribute->localname, env);
 }
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL