# document
[AXIOM]

## Typedefs
typedef struct axiom_document | axiom_document_t
## Functions
AXIS2_EXTERN axiom_document_t * | axiom_document_create (const axutil_env_t *env, axiom_node_t *root, struct axiom_stax_builder *builder)
AXIS2_EXTERN void | axiom_document_free (struct axiom_document *document, const axutil_env_t *env)
AXIS2_EXTERN void | axiom_document_free_self (struct axiom_document *document, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_document_build_next (struct axiom_document *document, const axutil_env_t *env)
AXIS2_EXTERN axiom_node_t * | axiom_document_get_root_element (struct axiom_document *document, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axiom_document_set_root_element (struct axiom_document *document, const axutil_env_t *env, axiom_node_t *om_node)
AXIS2_EXTERN axiom_node_t * | axiom_document_build_all (struct axiom_document *document, const axutil_env_t *env)
AXIS2_EXTERN struct axiom_stax_builder * | axiom_document_get_builder (struct axiom_document *document, const axutil_env_t *env)
AXIS2_EXTERN void | axiom_document_set_builder (axiom_document_t *document, const axutil_env_t *env, struct axiom_stax_builder *builder)
AXIS2_EXTERN axis2_status_t | axiom_document_serialize (struct axiom_document *document, const axutil_env_t *env, axiom_output_t *om_output)

## Function Documentation

AXIS2_EXTERN axiom_node_t* axiom_document_build_all | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env |
| ) |  |  |

This method builds the rest of the xml input stream from current position till the root element is completed .

Parameters:

  | document | pointer to axiom_document_t struct to be built.
  | env | environment MUST NOT be NULL.

AXIS2_EXTERN axiom_node_t* axiom_document_build_next | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env |
| ) |  |  |

Builds the next node if the builder is not finished with input xml stream

Parameters:

  | document | document whose next node is to be built. cannot be NULL
  | env | Environment. MUST NOT be NULL.

Returns:
  pointer to the next node. NULL on error.

AXIS2_EXTERN axiom_document_t* axiom_document_create | ( | const axutil_env_t * | env,
|  | axiom_node_t * | root,
|  | struct axiom_stax_builder * | builder |
| ) |  |  |

creates an axiom_document_t struct

Parameters:

  | env | Environment. MUST NOT be NULL.
  | root | pointer to document's root node. Optional, can be NULL
  | builder | pointer to axiom_stax_builder

Returns:
  pointer to the newly created document.

AXIS2_EXTERN void axiom_document_free | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env |
| ) |  |  |

Free document struct

Parameters:

  | document | pointer to axiom_document_t struct 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_document_free_self | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env |
| ) |  |  |

Free document struct only, Does not free the associated axiom struture.

Parameters:

  | document | pointer to axiom_document_t struct to be freed
  | env | Environment. MUST NOT be NULL

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

AXIS2_EXTERN struct axiom_stax_builder* axiom_document_get_builder | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env |
| ) |  |  | `[read]`

get builder

Parameters:

  | document | pointer to axiom_document_t struct to be built.
  | env | environment MUST NOT be NULL.

Returns:
  builder, returns NULL if a builder is not associated with document

AXIS2_EXTERN axiom_node_t* axiom_document_get_root_element | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the root element of the document.

Parameters:

  | document | document to return the root of
  | env | Environment. MUST NOT be NULL.

Returns:
  returns a pointer to the root node. If no root present, this method tries to build the root. Returns NULL on error.

AXIS2_EXTERN axis2_status_t axiom_document_serialize | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env,
|  | axiom_output_t * | om_output |
| ) |  |  |

Parameters:

  | om_document |

Returns:
  status code AXIS2_SUCCESS on success , otherwise AXIS2_FAILURE

AXIS2_EXTERN void axiom_document_set_builder | ( | axiom_document_t * | document,
|  | const axutil_env_t * | env,
|  | struct axiom_stax_builder * | builder |
| ) |  |  |

sets builder for document.

Parameters:

  | document | pointer to axiom_document_t struct to be built.
  | env | environment MUST NOT be NULL.
  | builder | pointer to builder to associate with document

AXIS2_EXTERN axis2_status_t axiom_document_set_root_element | ( | struct axiom_document * | document,
|  | const axutil_env_t * | env,
|  | axiom_node_t * | om_node |
| ) |  |  |

set the root element of the document. IF a root node is already exist,it is freed before setting to root element

Parameters:

  | document | document struct to return the root of
  | env | Environment. MUST NOT be NULL.

Returns:
  returns status code AXIS2_SUCCESS on success ,AXIS2_FAILURE on error.