# OXS Axiom
[OMXMLSecurity]

## Functions
AXIS2_EXTERN axis2_status_t | oxs_axiom_add_attribute (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *attribute_ns, axis2_char_t *attribute_ns_uri, axis2_char_t *attribute, axis2_char_t *value)
AXIS2_EXTERN int | oxs_axiom_get_number_of_children_with_qname (const axutil_env_t *env, axiom_node_t *parent, axis2_char_t *local_name, axis2_char_t *ns_uri, axis2_char_t *prefix)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_get_node_by_local_name (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *local_name)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_get_node_by_id (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *attr, axis2_char_t *val, axis2_char_t *ns)
AXIS2_EXTERN axis2_char_t * | oxs_axiom_get_attribute_value_of_node_by_name (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *attribute_name, axis2_char_t *ns)
AXIS2_EXTERN axis2_char_t * | oxs_axiom_get_attribute_val_of_node_by_qname (const axutil_env_t *env, axiom_node_t *node, axutil_qname_t *qname)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_get_first_child_node_by_name (const axutil_env_t *env, axiom_node_t *parent, axis2_char_t *local_name, axis2_char_t *ns_uri, axis2_char_t *prefix)
AXIS2_EXTERN axis2_char_t * | oxs_axiom_get_node_content (const axutil_env_t *env, axiom_node_t *node)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_deserialize_node (const axutil_env_t *env, axis2_char_t *buffer)
AXIS2_EXTERN axis2_bool_t | oxs_axiom_check_node_name (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *name, axis2_char_t *ns)
AXIS2_EXTERN axis2_status_t | oxs_axiom_interchange_nodes (const axutil_env_t *env, axiom_node_t *node_to_move, axiom_node_t *node_before)
AXIS2_EXTERN axis2_status_t | oxs_axiom_add_as_the_first_child (const axutil_env_t *env, axiom_node_t *parent, axiom_node_t *child)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_get_first_node_by_name_and_attr_val (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *e_name, axis2_char_t *e_ns, axis2_char_t *attr_name, axis2_char_t *attr_val, axis2_char_t *attr_ns)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_get_first_node_by_name_and_attr_val_from_xml_doc (const axutil_env_t *env, axiom_node_t *node, axis2_char_t *e_name, axis2_char_t *e_ns, axis2_char_t *attr_name, axis2_char_t *attr_val, axis2_char_t *attr_ns)
AXIS2_EXTERN axiom_node_t * | oxs_axiom_clone_node (const axutil_env_t *env, axiom_node_t *node)

## Function Documentation

AXIS2_EXTERN axis2_status_t oxs_axiom_add_as_the_first_child | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent,
|  | axiom_node_t * | child |
| ) |  |  |

Adds as the first child of

Parameters:

  | env | Environment. Must not be null
  | parent | parent node
  | child | child node which has to be the first child of parent

Returns:
  status of the operation

AXIS2_EXTERN axis2_status_t oxs_axiom_add_attribute | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | attribute_ns,
|  | axis2_char_t * | attribute_ns_uri,
|  | axis2_char_t * | attribute,
|  | axis2_char_t * | value |
| ) |  |  |

Adds an attribute to a particular node

Parameters:

  | env | Environment. MUST NOT be NULL
  | node | the node where the attibute will be added
  | attribute_ns | the the ns_prefix of the attribute
  | attribute_ns_uri | the uri of the attribute
  | attribute | the localname of the attribute
  | value | the value of the attribute

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_bool_t oxs_axiom_check_node_name | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | name,
|  | axis2_char_t * | ns |
| ) |  |  |

Checks whether given node is having same name and namespace as given

Parameters:

  | env | Environment. Must not be null
  | node | node to be checked for name and namespace
  | name | local name to be checked against given node
  | ns | namespace to be checked against given node. Can be null. If null, will be omitted

Returns:
  AXIS2_TRUE if given name/ns is same as in the node. AXIS2_FALSE otherwise.

AXIS2_EXTERN axiom_node_t* oxs_axiom_clone_node | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node |
| ) |  |  |

Clones the given node.

Parameters:

  | env | Environment. Must not be null
  | node | node to be cloned

Returns:
  cloned node if success. NULL otherwise

AXIS2_EXTERN axiom_node_t* oxs_axiom_deserialize_node | ( | const axutil_env_t * | env,
|  | axis2_char_t * | buffer |
| ) |  |  |

Deserialises given buffer and creates the axiom node

Parameters:

  | env | Environment. Must not be NULL
  | buffer | representation of serialised node

Returns:
  deserialised node if success. NULL otherwise.

AXIS2_EXTERN axis2_char_t* oxs_axiom_get_attribute_val_of_node_by_qname | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axutil_qname_t * | qname |
| ) |  |  |

Traverse thru the node and its descendents. Check if the node has a particular attribute with qname as in . Returns the attribute value.

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node to be searched
  | qname | the qname of the attribute

Returns:
  the attribute value if found, else NULL

AXIS2_EXTERN axis2_char_t* oxs_axiom_get_attribute_value_of_node_by_name | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | attribute_name,
|  | axis2_char_t * | ns |
| ) |  |  |

Traverse thru the node and its descendents. Check if the node has a particular attribute with name as in and namespace as in . Returns the attribute value.

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node to be searched
  | attribute_name | the attribute name of the node
  | ns | namespace of the attribute

Returns:
  the attribute value if found, else NULL

AXIS2_EXTERN axiom_node_t* oxs_axiom_get_first_child_node_by_name | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent,
|  | axis2_char_t * | local_name,
|  | axis2_char_t * | ns_uri,
|  | axis2_char_t * | prefix |
| ) |  |  |

Check the node and its children. Check if the localname is equal to the given name Note: You may pass the prefix=NULL as the prefix may be different depending on the impl

Parameters:

  | env | Environment. MUST NOT be NULL,
  | parent | the node to be searched
  | local_name | the local name of the node to be searched namespace uri of the node to be searched prefix of the node to be searched. If NULL, node with any prefix will be considered

Returns:
  the node if found, else NULL

AXIS2_EXTERN axiom_node_t* oxs_axiom_get_first_node_by_name_and_attr_val | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | e_name,
|  | axis2_char_t * | e_ns,
|  | axis2_char_t * | attr_name,
|  | axis2_char_t * | attr_val,
|  | axis2_char_t * | attr_ns |
| ) |  |  |

Traverse thru the node and its children. Check if the element has the given qname and has a id attribute equal to the given value.

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node to be searched
  | e_name | element name
  | e_ns | element namespace. If NULL doesn't consider the namespaces
  | attr_name | the attribute name of the node
  | attr_val | the attribute value of the node
  | attr_ns | the attribute namespace. If NULL doesn't consider namespaces.

Returns:
  the node if found, else NULL

AXIS2_EXTERN axiom_node_t* oxs_axiom_get_first_node_by_name_and_attr_val_from_xml_doc | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | e_name,
|  | axis2_char_t * | e_ns,
|  | axis2_char_t * | attr_name,
|  | axis2_char_t * | attr_val,
|  | axis2_char_t * | attr_ns |
| ) |  |  |

First find the root of the scope node. Traverse thru the root node and its children. Check if the element has the given qname and has a attribute equal to the given values.

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node to be searched
  | e_name | element name
  | e_ns | element namespace. If NULL doesn't consider the namespaces
  | attr_name | the attribute name of the node
  | attr_val | the attribute value of the node
  | attr_ns | the attribute namespace. If NULL doesn't consider namespaces.

Returns:
  the node if found, else NULL

AXIS2_EXTERN axiom_node_t* oxs_axiom_get_node_by_id | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | attr,
|  | axis2_char_t * | val,
|  | axis2_char_t * | ns |
| ) |  |  |

Traverse thru the node and its descendents. Check if the node has a particular attibure value, whose attribute name as in and value as in

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node to be searched
  | attr | the attribute name of the node
  | val | the attribute value of the node
  | ns | namespace of the attribute

Returns:
  the node if found, else NULL

AXIS2_EXTERN axiom_node_t* oxs_axiom_get_node_by_local_name | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node,
|  | axis2_char_t * | local_name |
| ) |  |  |

Traverse thru the node and its descendents. Check if the localname is equal to the given name

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node to be searched
  | localname | the local name of the node to be searched

Returns:
  the node if found, else NULL

AXIS2_EXTERN axis2_char_t* oxs_axiom_get_node_content | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node |
| ) |  |  |

Returns content of a node

Parameters:

  | env | Environment. MUST NOT be NULL,
  | node | the node whose content should be retrieved

Returns:
  the content of the node if found, else NULL

AXIS2_EXTERN int oxs_axiom_get_number_of_children_with_qname | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent,
|  | axis2_char_t * | local_name,
|  | axis2_char_t * | ns_uri,
|  | axis2_char_t * | prefix |
| ) |  |  |

Finds the number of childern with given qname

Parameters:

  | env | Environment. MUST NOT be NULL,
  | parent | the root element defining start of the search
  | localname | the local part of the qname
  | ns_uri | uri part of the qname
  | prefix | the prefix part of the qname

Returns:
  the number of children found

AXIS2_EXTERN axis2_status_t oxs_axiom_interchange_nodes | ( | const axutil_env_t * | env,
|  | axiom_node_t * | node_to_move,
|  | axiom_node_t * | node_before |
| ) |  |  |

moves the given node before second node.

Parameters:

  | env | Environment. Must not be null
  | node_to_move | node to be moved
  | node_before | node_to_move will be moved before this node

Returns:
  status of the operation