# node
[AXIOM]

## Enumerations
enum | axiom_types_t { AXIOM_INVALID = 0, AXIOM_DOCUMENT, AXIOM_ELEMENT, AXIOM_DOCTYPE, AXIOM_COMMENT, AXIOM_ATTRIBUTE, AXIOM_NAMESPACE, AXIOM_PROCESSING_INSTRUCTION, AXIOM_TEXT, AXIOM_DATA_SOURCE }
| AXIOM types. More...
## Functions
AXIS2_EXTERN axiom_node_t * | axiom_node_create (const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_node_create_from_buffer (const axutil_env_t *env, axis2_char_t *buffer)
AXIS2_EXTERN void | axiom_node_free_tree (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axiom_node_add_child (axiom_node_t *om_node, const axutil_env_t *env, axiom_node_t *child)
AXIS2_EXTERN axiom_node_t * | axiom_node_detach (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axiom_node_insert_sibling_after (axiom_node_t *om_node, const axutil_env_t *env, axiom_node_t *node_to_insert)
AXIS2_EXTERN axis2_status_t | axiom_node_insert_sibling_before (axiom_node_t *om_node, const axutil_env_t *env, axiom_node_t *node_to_insert)
AXIS2_EXTERN axis2_status_t | axiom_node_serialize (axiom_node_t *om_node, const axutil_env_t *env, struct axiom_output *om_output)
AXIS2_EXTERN axiom_node_t * | axiom_node_get_parent (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_node_get_first_child (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_node_get_first_element (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_node_get_last_child (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_node_get_previous_sibling (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_node_get_next_sibling (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axiom_types_t | axiom_node_get_node_type (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN void * | axiom_node_get_data_element (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axiom_node_is_complete (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN struct axiom_document * | axiom_node_get_document (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_node_to_string (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axiom_node_serialize_sub_tree (axiom_node_t *om_node, const axutil_env_t *env, struct axiom_output *om_output)
AXIS2_EXTERN axis2_char_t * | axiom_node_sub_tree_to_string (axiom_node_t *om_node, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_node_to_string_non_optimized (axiom_node_t *om_node, const axutil_env_t *env)

## Enumeration Type Documentation

enum axiom_types_t

AXIOM types.

Enumerator:

  AXIOM_INVALID | Invalid node type
  AXIOM_DOCUMENT | AXIOM document type
  AXIOM_ELEMENT | AXIOM element type
  AXIOM_DOCTYPE | AXIOM doctype type
  AXIOM_COMMENT | AXIOM comment type
  AXIOM_ATTRIBUTE | AXIOM attribute type
  AXIOM_NAMESPACE | AXIOM namespace type
  AXIOM_PROCESSING_INSTRUCTION | AXIOM processing instruction type
  AXIOM_TEXT | AXIOM text type
  AXIOM_DATA_SOURCE | AXIOM data source, represent a serialized XML fragment with a stream

## Function Documentation

AXIS2_EXTERN axis2_status_t axiom_node_add_child | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env,
|  | axiom_node_t * | child |
| ) |  |  |

Adds given node as child to parent. child should not have a parent if child has a parent it will be detached from existing parent

Parameters:

  | om_node | parent node. cannot be NULL.
  | env | Environment. MUST NOT be NULL, .
  | child | child node.

Returns:
  satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN axiom_node_t* axiom_node_create | ( | const axutil_env_t * | env | ) |

Creates a node struct.

Parameters:

  | env | Environment. MUST NOT be NULL, .

Returns:
  a pointer to newly created node struct. NULL on error.

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

Creates a node struct from a character buffer.

Parameters:

  | env | Environment. MUST NOT be NULL, .
  | buffer | string. buffer to make the node

Returns:
  a pointer to newly created node struct. NULL on error.

AXIS2_EXTERN axiom_node_t* axiom_node_detach | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

Detaches given node from the parent and reset the links

Parameters:

  | om_node | node to be detached, cannot be NULL.
  | env | Environment. MUST NOT be NULL, .

Returns:
  a pointer to detached node,returns NULL on error with error code set to environment's error struct

AXIS2_EXTERN void axiom_node_free_tree | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

Frees an om node and all of its children. Please note that the attached data_element will also be freed along with the node. If the node is still attached to a parent, it will be detached first, then freed.

Parameters:

  | om_node | node to be freed.
  | env | Environment. MUST NOT be NULL, .

Returns:
  satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN void* axiom_node_get_data_element | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get the struct contained in the node IF the node is on type AXIOM_ELEMENT , this method returns a pointer to axiom_element_t struct contained

Parameters:

  | om_node | node
  | env | environment, MUST NOT be NULL.

Returns:
  pointer to struct contained in the node returns NULL if no struct is contained

AXIS2_EXTERN struct axiom_document* axiom_node_get_document | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  | `[read]`

returns the associated document, only valid if built using builder and for a node of type AXIOM_ELEMENT returns null if no document is available

Parameters:

  | om_node |
  | env | environment, MUST NOT be NULL.

Returns:
  the OM document of the node

AXIS2_EXTERN axiom_node_t* axiom_node_get_first_child | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get the first child of om_node

Parameters:

  | om_node | node
  | env | environment must not be null.

Returns:
  pointer to first child node , NULL is returned on error with error code set in environments error

AXIS2_EXTERN axiom_node_t* axiom_node_get_first_element | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get the first AXIOM_ELEMENT in om_node

Parameters:

  | om_node | node
  | env | environment must not be null

Returns:
  pointer to first child om element, NULL is returned on error with error code set in environments error.

AXIS2_EXTERN axiom_node_t* axiom_node_get_last_child | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get the last child

Parameters:

  | om_node | node
  | env | environment, MUST NOT be NULL

Returns:
  pointer to last child of this node , return NULL on error.

AXIS2_EXTERN axiom_node_t* axiom_node_get_next_sibling | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get next sibling

Parameters:

  | om_node | om_node struct
  | env | environment, MUST NOT be NULL.

Returns:
  next sibling of this node.

AXIS2_EXTERN axiom_types_t axiom_node_get_node_type | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get the node type of this element Node type can be one of AXIOM_ELEMENT, AXIOM_COMMENT, AXIOM_TEXT AXIOM_DOCTYPE, AXIOM_PROCESSING_INSTRUCTION

Parameters:

  | om_node | node of which node type is required
  | env | environment

Returns:
  node type

AXIS2_EXTERN axiom_node_t* axiom_node_get_parent | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get parent of om_node node

Parameters:

  | env | environment

Returns:
  pointer to parent node of om_node, return NULL if no parent exists or when an error occured.

AXIS2_EXTERN axiom_node_t* axiom_node_get_previous_sibling | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

get the previous sibling

Parameters:

  | om_node | om_node struct
  | env | environment , must node be null

Returns:
  a pointer to previous sibling , NULL if a previous sibling does not exits (happens when this node is the first child of a node )

AXIS2_EXTERN axis2_status_t axiom_node_insert_sibling_after | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env,
|  | axiom_node_t * | node_to_insert |
| ) |  |  |

Inserts a sibling node after the given node

Parameters:

  | om_node | node to whom the sibling to be inserted. , cannot be NULL.
  | env | Environment. MUST NOT be NULL, .
  | node_to_insert | the node to be inserted. , cannot be NULL.

Returns:
  satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axiom_node_insert_sibling_before | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env,
|  | axiom_node_t * | node_to_insert |
| ) |  |  |

Inserts a sibling node before the given current node

Parameters:

  | om_node | node to whom the sibling to be inserted. , cannot be NULL.
  | env | Environment. MUST NOT be NULL, .
  | node_to_insert | the node to be inserted. , cannot be NULL.

Returns:
  satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN axis2_bool_t axiom_node_is_complete | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

Indicates whether parser has parsed this information item completely or not

Parameters:

  | om_node | om_node struct
  | env | environment, MUST NOT be NULL.

Returns:
  AXIS2_TRUE if node is completly build, AXIS2_FALSE if node is not completed

AXIS2_EXTERN axis2_status_t axiom_node_serialize | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env,
|  | struct axiom_output * | om_output |
| ) |  |  |

Serializes the given node. This op makes the node go through its children and serialize them in order.

Parameters:

  | om_node | node to be serialized. cannot be NULL.
  | env | Environment .MUST NOT be NULL.
  | om_output | AXIOM output handler to be used in serializing

Returns:
  satus of the op. AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axiom_node_serialize_sub_tree | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env,
|  | struct axiom_output * | om_output |
| ) |  |  |

Parameters:

  | om_node | pointer to the OM node struct
  | env | environment, MUST NOT be NULL
  | om_output | the serialized output will be placed here

Returns:
  AXIS2_SUCCESS on success else AXIS2_FAILURE

AXIS2_EXTERN axis2_char_t* axiom_node_sub_tree_to_string | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | om_node | pointer to the OM node struct
  | env | environment, MUST NOT be NULL

Returns:
  the tree as a string

AXIS2_EXTERN axis2_char_t* axiom_node_to_string | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | om_node | pointer to the OM node struct
  | env | environment, MUST NOT be NULL

Returns:
  the string representation of the node

AXIS2_EXTERN axis2_char_t* axiom_node_to_string_non_optimized | ( | axiom_node_t * | om_node,
|  | const axutil_env_t * | env |
| ) |  |  |

Convert the node to string, treating the binary contents, if any, as non-optimized content.

Parameters:

  | om_node | pointer to the OM node struct
  | env | environment, MUST NOT be NULL

Returns:
  the none optimized string