# XML reader
[parser]

## Classes
struct | axiom_xml_reader_ops
| AXIOM_XML_READER ops Encapsulator struct for ops of axiom_xml_reader. More...
struct | axiom_xml_reader
| axiom_xml_reader struct Axis2 OM pull_parser More...
## Enumerations
enum | axiom_xml_reader_event_types { AXIOM_XML_READER_START_DOCUMENT = 0, AXIOM_XML_READER_START_ELEMENT, AXIOM_XML_READER_END_ELEMENT, AXIOM_XML_READER_SPACE, AXIOM_XML_READER_EMPTY_ELEMENT, AXIOM_XML_READER_CHARACTER, AXIOM_XML_READER_ENTITY_REFERENCE, AXIOM_XML_READER_COMMENT, AXIOM_XML_READER_PROCESSING_INSTRUCTION, AXIOM_XML_READER_CDATA, AXIOM_XML_READER_DOCUMENT_TYPE }
## Functions
AXIS2_EXTERN axiom_xml_reader_t * | axiom_xml_reader_create_for_file (const axutil_env_t *env, char *filename, const axis2_char_t *encoding)
AXIS2_EXTERN axiom_xml_reader_t * | axiom_xml_reader_create_for_io (const axutil_env_t *env, AXIS2_READ_INPUT_CALLBACK, AXIS2_CLOSE_INPUT_CALLBACK, void *ctx, const axis2_char_t *encoding)
AXIS2_EXTERN axiom_xml_reader_t * | axiom_xml_reader_create_for_memory (const axutil_env_t *env, void *container, int size, const axis2_char_t *encoding, int type)
AXIS2_EXTERN axis2_status_t | axiom_xml_reader_init (void)
AXIS2_EXTERN axis2_status_t | axiom_xml_reader_cleanup (void)
AXIS2_EXTERN int | axiom_xml_reader_next (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN void | axiom_xml_reader_free (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN int | axiom_xml_reader_get_attribute_count (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_attribute_name_by_number (axiom_xml_reader_t *parser, const axutil_env_t *env, int i)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_attribute_prefix_by_number (axiom_xml_reader_t *parser, const axutil_env_t *env, int i)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_attribute_value_by_number (axiom_xml_reader_t *parser, const axutil_env_t *env, int i)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_attribute_namespace_by_number (axiom_xml_reader_t *parser, const axutil_env_t *env, int i)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_value (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN int | axiom_xml_reader_get_namespace_count (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_namespace_uri_by_number (axiom_xml_reader_t *parser, const axutil_env_t *env, int i)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_namespace_prefix_by_number (axiom_xml_reader_t *parser, const axutil_env_t *env, int i)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_prefix (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_name (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_pi_target (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_pi_data (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_dtd (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN void | axiom_xml_reader_xml_free (axiom_xml_reader_t *parser, const axutil_env_t *env, void *data)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_char_set_encoding (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_namespace_uri (axiom_xml_reader_t *parser, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | axiom_xml_reader_get_namespace_uri_by_prefix (axiom_xml_reader_t *parser, const axutil_env_t *env, axis2_char_t *prefix)

## Function Documentation

AXIS2_EXTERN axis2_status_t axiom_xml_reader_cleanup | ( | void |  | ) |

parser cleanup function. This function is used to clean up the globals of libxml2 parser.

AXIS2_EXTERN axiom_xml_reader_t* axiom_xml_reader_create_for_file | ( | const axutil_env_t * | env,
|  | char * | filename,
|  | const axis2_char_t * | encoding |
| ) |  |  |

Creates an instance of axiom_xml_reader to parse a file using an xml document in a file system

Parameters:

  | env | environment struct, must not be null
  | filename | url of an xml document

Returns:
  a pointer to xml_pull_parser_t struct NULL on error with error code set in the environment's error

AXIS2_EXTERN axiom_xml_reader_t* axiom_xml_reader_create_for_io | ( | const axutil_env_t * | env,
|  | AXIS2_READ_INPUT_CALLBACK | ,
|  | AXIS2_CLOSE_INPUT_CALLBACK | ,
|  | void * | ctx,
|  | const axis2_char_t * | encoding |
| ) |  |  |

This create an instance of axiom_xml_reader to parse a xml document in a buffer. It takes a callback function that takes a buffer and the size of the buffer The user must implement a function that takes in buffer and size and fill the buffer with specified size with xml stream, parser will call this function to fill the buffer on the fly while parsing.

Parameters:

  | env | environment MUST NOT be NULL.
  | read_input_callback() | callback function that fills a char buffer.
  | close_input_callback() | callback function that closes the input stream.
  | ctx,context | can be any data that needs to be passed to the callback method.
  | encoding | encoding scheme of the xml stream

AXIS2_EXTERN axiom_xml_reader_t* axiom_xml_reader_create_for_memory | ( | const axutil_env_t * | env,
|  | void * | container,
|  | int | size,
|  | const axis2_char_t * | encoding,
|  | int | type |
| ) |  |  |

Create an axiom_xml_reader_t using a buffer, which is the xml input

Parameters:

  | env | environment, MUST not be NULL
  | container | any data that needs to passed to the corresponding parser's create_for_memory method. The reader does not take ownership of this data.
  | size | size of the buffer
  | encoding | encoding of the xml

Returns:
  pointer to axiom_xml_reader_t struct on success , NULL otherwise

AXIS2_EXTERN void axiom_xml_reader_free | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN int axiom_xml_reader_get_attribute_count | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

free method for xml reader

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_attribute_name_by_number | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | int | i |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  number of attributes in an element

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_attribute_namespace_by_number | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | int | i |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  attribute value by number

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_attribute_prefix_by_number | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | int | i |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  the attribute name by number

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_attribute_value_by_number | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | int | i |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  the attribute prefix by number

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_char_set_encoding | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

free method for xml

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_dtd | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_name | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  namespace prefix

AXIS2_EXTERN int axiom_xml_reader_get_namespace_count | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  value of the element

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_namespace_prefix_by_number | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | int | i |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  uri or the namespace by number

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_namespace_uri | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  charactor encoding

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_namespace_uri_by_number | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | int | i |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  the number of namespaces in an element

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_namespace_uri_by_prefix | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | axis2_char_t * | prefix |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_pi_data | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_pi_target | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  name of the element

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_prefix | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  prefix of the namespace by number

AXIS2_EXTERN axis2_char_t* axiom_xml_reader_get_value | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:
  attribute namespace by number

AXIS2_EXTERN axis2_status_t axiom_xml_reader_init | ( | void |  | ) |

init function initializes the parser. When using libxml2 parser, this function is needed to initialize libxml2.

AXIS2_EXTERN int axiom_xml_reader_next | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env |
| ) |  |  |

while parsing through this method is calling for each and every time it parse a charactor.This is the atomic method which parse charactors.

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns:

AXIS2_EXTERN void axiom_xml_reader_xml_free | ( | axiom_xml_reader_t * | parser,
|  | const axutil_env_t * | env,
|  | void * | data |
| ) |  |  |

Parameters:

  | parser | pointer to the OM XML Reader struct
  | env | environment struct, must not be null

Returns: