SAX2

## SAX2 SAX2 — SAX2 XML Parsing API with namespaces and base URI support. |

## Functions

raptor_sax2 * | raptor_new_sax2 ()
void | raptor_free_sax2 ()
void | (*raptor_sax2_start_element_handler) ()
void | (*raptor_sax2_end_element_handler) ()
void | (*raptor_sax2_characters_handler) ()
void | (*raptor_sax2_cdata_handler) ()
void | (*raptor_sax2_comment_handler) ()
void | (*raptor_sax2_unparsed_entity_decl_handler) ()
int | (*raptor_sax2_external_entity_ref_handler) ()
void | raptor_sax2_set_start_element_handler ()
void | raptor_sax2_set_end_element_handler ()
void | raptor_sax2_set_characters_handler ()
void | raptor_sax2_set_cdata_handler ()
void | raptor_sax2_set_comment_handler ()
void | raptor_sax2_set_unparsed_entity_decl_handler ()
void | raptor_sax2_set_external_entity_ref_handler ()
void | raptor_sax2_set_namespace_handler ()
void | raptor_sax2_set_uri_filter ()
void | raptor_sax2_parse_start ()
int | raptor_sax2_parse_chunk ()
const unsigned char * | raptor_sax2_inscope_xml_language ()
raptor_uri * | raptor_sax2_inscope_base_uri ()

## Types and Values

typedef | raptor_sax2

## Description

A class providing a SAX2 XML parsing API with XML namespaces and XML base support.

## Functions

### raptor_new_sax2 ()

    raptor_sax2 *
    raptor_new_sax2 (raptor_world *world,
                     raptor_locator *locator,
                     void *user_data);

#### Returns

### raptor_free_sax2 ()

    void
    raptor_free_sax2 (raptor_sax2 *sax2);

### raptor_sax2_start_element_handler ()

    void
    (*raptor_sax2_start_element_handler) (void *user_data,
                                          raptor_xml_element *xml_element);

SAX2 start element handler

#### Parameters

user_data | user data |
xml_element | XML element |

### raptor_sax2_end_element_handler ()

    void
    (*raptor_sax2_end_element_handler) (void *user_data,
                                        raptor_xml_element *xml_element);

SAX2 end element handler

#### Parameters

user_data | user data |
xml_element | XML element |

### raptor_sax2_characters_handler ()

    void
    (*raptor_sax2_characters_handler) (void *user_data,
                                       raptor_xml_element *xml_element,
                                       const unsigned char *s,
                                       int len);

SAX2 characters handler

#### Parameters

user_data | user data |
xml_element | XML element |
s | string |
len | string len |

### raptor_sax2_cdata_handler ()

    void
    (*raptor_sax2_cdata_handler) (void *user_data,
                                  raptor_xml_element *xml_element,
                                  const unsigned char *s,
                                  int len);

SAX2 CDATA section handler

#### Parameters

user_data | user data |
xml_element | XML element |
s | string |
len | string len |

### raptor_sax2_comment_handler ()

    void
    (*raptor_sax2_comment_handler) (void *user_data,
                                    raptor_xml_element *xml_element,
                                    const unsigned char *s);

SAX2 XML comment handler

#### Parameters

user_data | user data |
xml_element | XML element |
s | string |

### raptor_sax2_unparsed_entity_decl_handler ()

    void
    (*raptor_sax2_unparsed_entity_decl_handler)
                                   (void *user_data,
                                    const unsigned char *entityName,
                                    const unsigned char *base,
                                    const unsigned char *systemId,
                                    const unsigned char *publicId,
                                    const unsigned char *notationName);

SAX2 unparsed entity (NDATA) handler

#### Parameters

user_data | user data |
entityName | entity name |
base | base URI |
systemId | system ID |
publicId | public ID |
notationName | notation name |

### raptor_sax2_external_entity_ref_handler ()

    int
    (*raptor_sax2_external_entity_ref_handler)
                                   (void *user_data,
                                    const unsigned char *context,
                                    const unsigned char *base,
                                    const unsigned char *systemId,
                                    const unsigned char *publicId);

SAX2 external entity reference handler

#### Parameters

user_data | user data |
context | context |
base | base URI |
systemId | system ID |
publicId | public ID |

#### Returns

0 if processing should not continue because of a fatal error in the handling of the external entity.

### raptor_sax2_set_start_element_handler ()

    void
    raptor_sax2_set_start_element_handler (raptor_sax2 *sax2,
                                           raptor_sax2_start_element_handler handler);

### raptor_sax2_set_end_element_handler ()

    void
    raptor_sax2_set_end_element_handler (raptor_sax2 *sax2,
                                         raptor_sax2_end_element_handler handler);

### raptor_sax2_set_characters_handler ()

    void
    raptor_sax2_set_characters_handler (raptor_sax2 *sax2,
                                        raptor_sax2_characters_handler handler);

### raptor_sax2_set_cdata_handler ()

    void
    raptor_sax2_set_cdata_handler (raptor_sax2 *sax2,
                                   raptor_sax2_cdata_handler handler);

### raptor_sax2_set_comment_handler ()

    void
    raptor_sax2_set_comment_handler (raptor_sax2 *sax2,
                                     raptor_sax2_comment_handler handler);

### raptor_sax2_set_unparsed_entity_decl_handler ()

    void
    raptor_sax2_set_unparsed_entity_decl_handler
                                   (raptor_sax2 *sax2,
                                    raptor_sax2_unparsed_entity_decl_handler handler);

### raptor_sax2_set_external_entity_ref_handler ()

    void
    raptor_sax2_set_external_entity_ref_handler
                                   (raptor_sax2 *sax2,
                                    raptor_sax2_external_entity_ref_handler handler);

### raptor_sax2_set_namespace_handler ()

    void
    raptor_sax2_set_namespace_handler (raptor_sax2 *sax2,
                                       raptor_namespace_handler handler);

### raptor_sax2_set_uri_filter ()

    void
    raptor_sax2_set_uri_filter (raptor_sax2 *sax2,
                                raptor_uri_filter_func filter,
                                void *user_data);

### raptor_sax2_parse_start ()

    void
    raptor_sax2_parse_start (raptor_sax2 *sax2,
                             raptor_uri *base_uri);

### raptor_sax2_parse_chunk ()

    int
    raptor_sax2_parse_chunk (raptor_sax2 *sax2,
                             const unsigned char *buffer,
                             size_t len,
                             int is_end);

#### Returns

### raptor_sax2_inscope_xml_language ()

    const unsigned char *
    raptor_sax2_inscope_xml_language (raptor_sax2 *sax2);

#### Returns

### raptor_sax2_inscope_base_uri ()

    raptor_uri *
    raptor_sax2_inscope_base_uri (raptor_sax2 *sax2);

#### Returns

## Types and Values

### raptor_sax2

    typedef struct raptor_sax2_s raptor_sax2;

Raptor SAX2 class