# stax builder
[AXIOM]

## Typedefs
typedef struct axiom_stax_builder | axiom_stax_builder_t
## Functions
AXIS2_EXTERN axiom_stax_builder_t * | axiom_stax_builder_create (const axutil_env_t *env, axiom_xml_reader_t *parser)
AXIS2_EXTERN axiom_node_t * | axiom_stax_builder_next (struct axiom_stax_builder *builder, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axiom_stax_builder_discard_current_element (struct axiom_stax_builder *builder, const axutil_env_t *env)
AXIS2_EXTERN void | axiom_stax_builder_free (struct axiom_stax_builder *builder, const axutil_env_t *env)
AXIS2_EXTERN void | axiom_stax_builder_free_self (struct axiom_stax_builder *builder, const axutil_env_t *env)
AXIS2_EXTERN axiom_document_t * | axiom_stax_builder_get_document (struct axiom_stax_builder *builder, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axiom_stax_builder_is_complete (struct axiom_stax_builder *builder, const axutil_env_t *env)
AXIS2_EXTERN int | axiom_stax_builder_next_with_token (struct axiom_stax_builder *builder, const axutil_env_t *env)

## Function Documentation

AXIS2_EXTERN axiom_stax_builder_t* axiom_stax_builder_create | ( | const axutil_env_t * | env,
|  | axiom_xml_reader_t * | parser |
| ) |  |  |

Creates an stax builder

Parameters:

  | environment | Environment. MUST NOT be NULL.
  | parser | parser to be used with builder. The builder will take ownership of the parser.

Returns:
  a pointer to the newly created builder struct.

AXIS2_EXTERN axis2_status_t axiom_stax_builder_discard_current_element | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

Discards the element that is being built currently.

Parameters:

  | environment | Environment. MUST NOT be NULL, .
  | builder | pointer to stax builder struct to be used

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

AXIS2_EXTERN void axiom_stax_builder_free | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

Free the build struct instance and its associated document,axiom tree.

Parameters:

  | builder | pointer to builder struct
  | env | environment, MUST NOT be NULL

Returns:
  status of the op AXIS2_SUCCESS on success, AXIS2_FAILURE on error.

AXIS2_EXTERN void axiom_stax_builder_free_self | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

Free the build struct instance and its associated document. does not free the associated axiom tree.

Parameters:

  | builder | pointer to builder struct
  | env | environment, MUST NOT be NULL

Returns:
  status of the op AXIS2_SUCCESS on success, AXIS2_FAILURE on error.

AXIS2_EXTERN axiom_document_t* axiom_stax_builder_get_document | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the document associated with the builder

Parameters:

  | builder | axiom_stax_builder
  | env | environment

Returns:
  pointer to document struct associated with builder NULL if there is no document associated with the builder, NULL if an error occured.

AXIS2_EXTERN axis2_bool_t axiom_stax_builder_is_complete | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

builder is finished building om structure

Parameters:

  | builder | pointer to stax builder struct to be used
  | environment | Environment. MUST NOT be NULL.

Returns:
  AXIS2_TRUE if is complete or AXIS2_FALSE otherwise

AXIS2_EXTERN axiom_node_t* axiom_stax_builder_next | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

Builds the next node from stream. Moves pull parser forward and reacts to events.

Parameters:

  | builder | pointer to stax builder struct to be used
  | environment | Environment. MUST NOT be NULL.

Returns:
  a pointer to the next node, or NULL if there are no more nodes. On erros sets the error and returns NULL.

AXIS2_EXTERN int axiom_stax_builder_next_with_token | ( | struct axiom_stax_builder * | builder,
|  | const axutil_env_t * | env |
| ) |  |  |

moves the reader to next event and returns the token returned by the xml_reader , returns -1 on error

Parameters:

  | builder | pointer to stax builder struct to be used
  | environment | Environment. MUST NOT be NULL.