Parser

## Parser Parser — RDF parsers - from a syntax to RDF triples |

## Functions

raptor_parser * | raptor_new_parser ()
raptor_parser * | raptor_new_parser_for_content ()
void | raptor_free_parser ()
void | (*raptor_graph_mark_handler) ()
void | (*raptor_namespace_handler) ()
void | raptor_parser_set_statement_handler ()
void | raptor_parser_set_graph_mark_handler ()
void | raptor_parser_set_namespace_handler ()
const raptor_syntax_description * | raptor_parser_get_description ()
raptor_locator * | raptor_parser_get_locator ()
void | raptor_parser_parse_abort ()
int | raptor_parser_parse_chunk ()
int | raptor_parser_parse_file ()
int | raptor_parser_parse_file_stream ()
int | raptor_parser_parse_iostream ()
int | raptor_parser_parse_start ()
int | raptor_parser_parse_uri ()
int | raptor_parser_parse_uri_with_connection ()
raptor_uri * | raptor_parser_get_graph ()
const char * | raptor_parser_get_name ()
int | raptor_parser_set_option ()
int | raptor_parser_get_option ()
const char * | raptor_parser_get_accept_header ()
void | raptor_parser_set_uri_filter ()
raptor_world * | raptor_parser_get_world ()

## Types and Values

typedef | raptor_parser
enum | raptor_graph_mark_flags

## Description

The parsing class that allows creating a parser for reading from a particular syntax (or can guess and use contextual information) that will on demand generate RDF triples to a handler function, as chunks of syntax data are passed into the parser. Parsing can be done from strings in memory, files or from URIs on the web.

There are also methods to deal with handling errors, warnings and returned triples as well as setting options (features) that can adjust how parsing is performed.

## Functions

### raptor_new_parser ()

    raptor_parser *
    raptor_new_parser (raptor_world *world,
                       const char *name);

#### Returns

### raptor_new_parser_for_content ()

    raptor_parser *
    raptor_new_parser_for_content (raptor_world *world,
                                   raptor_uri *uri,
                                   const char *mime_type,
                                   const unsigned char *buffer,
                                   size_t len,
                                   const unsigned char *identifier);

#### Returns

### raptor_free_parser ()

    void
    raptor_free_parser (raptor_parser *parser);

### raptor_graph_mark_handler ()

    void
    (*raptor_graph_mark_handler) (void *user_data,
                                  raptor_uri *graph,
                                  int flags);

Graph start/end mark handler function.

Records start and end of graphs happening in a stream of generated raptor_statement via the statement handler. The callback starts a graph when `flags` has RAPTOR_GRAPH_MARK_START bit set.

The start and ends may be either declared in the syntax via some keyword or mechanism such as TRiG {} syntax when `flags` has bit RAPTOR_GRAPH_MARK_DECLARED set, or be implied by the start/end of the data in other syntaxes, and the bit will be unset.

#### Parameters

user_data | user data |
graph | graph to report, NULL for the default graph |
flags | bitmask of raptor_graph_mark_flags flags |

### raptor_namespace_handler ()

    void
    (*raptor_namespace_handler) (void *user_data,
                                 raptor_namespace *nspace);

XML Namespace declaration reporting handler set by `raptor_parser_set_namespace_handler()`.

#### Parameters

user_data | user data |
nspace | raptor_namespace declared |

### raptor_parser_set_statement_handler ()

    void
    raptor_parser_set_statement_handler (raptor_parser *parser,
                                         void *user_data,
                                         raptor_statement_handler handler);

### raptor_parser_set_graph_mark_handler ()

    void
    raptor_parser_set_graph_mark_handler (raptor_parser *parser,
                                          void *user_data,
                                          raptor_graph_mark_handler handler);

### raptor_parser_set_namespace_handler ()

    void
    raptor_parser_set_namespace_handler (raptor_parser *parser,
                                         void *user_data,
                                         raptor_namespace_handler handler);

### raptor_parser_get_description ()

    const raptor_syntax_description *
    raptor_parser_get_description (raptor_parser *rdf_parser);

#### Returns

### raptor_parser_get_locator ()

    raptor_locator *
    raptor_parser_get_locator (raptor_parser *rdf_parser);

#### Returns

### raptor_parser_parse_abort ()

    void
    raptor_parser_parse_abort (raptor_parser *rdf_parser);

### raptor_parser_parse_chunk ()

    int
    raptor_parser_parse_chunk (raptor_parser *rdf_parser,
                               const unsigned char *buffer,
                               size_t len,
                               int is_end);

#### Returns

### raptor_parser_parse_file ()

    int
    raptor_parser_parse_file (raptor_parser *rdf_parser,
                              raptor_uri *uri,
                              raptor_uri *base_uri);

#### Returns

### raptor_parser_parse_file_stream ()

    int
    raptor_parser_parse_file_stream (raptor_parser *rdf_parser,
                                     FILE *stream,
                                     const char *filename,
                                     raptor_uri *base_uri);

#### Returns

### raptor_parser_parse_iostream ()

    int
    raptor_parser_parse_iostream (raptor_parser *rdf_parser,
                                  raptor_iostream *iostr,
                                  raptor_uri *base_uri);

#### Returns

### raptor_parser_parse_start ()

    int
    raptor_parser_parse_start (raptor_parser *rdf_parser,
                               raptor_uri *uri);

#### Returns

### raptor_parser_parse_uri ()

    int
    raptor_parser_parse_uri (raptor_parser *rdf_parser,
                             raptor_uri *uri,
                             raptor_uri *base_uri);

#### Returns

### raptor_parser_parse_uri_with_connection ()

    int
    raptor_parser_parse_uri_with_connection
                                   (raptor_parser *rdf_parser,
                                    raptor_uri *uri,
                                    raptor_uri *base_uri,
                                    void *connection);

#### Returns

### raptor_parser_get_graph ()

    raptor_uri *
    raptor_parser_get_graph (raptor_parser *rdf_parser);

#### Returns

### raptor_parser_get_name ()

    const char *
    raptor_parser_get_name (raptor_parser *rdf_parser);

#### Returns

### raptor_parser_set_option ()

    int
    raptor_parser_set_option (raptor_parser *parser,
                              raptor_option option,
                              const char *string,
                              int integer);

#### Returns

### raptor_parser_get_option ()

    int
    raptor_parser_get_option (raptor_parser *parser,
                              raptor_option option,
                              char **string_p,
                              int *integer_p);

#### Returns

### raptor_parser_get_accept_header ()

    const char *
    raptor_parser_get_accept_header (raptor_parser *rdf_parser);

#### Returns

### raptor_parser_set_uri_filter ()

    void
    raptor_parser_set_uri_filter (raptor_parser *parser,
                                  raptor_uri_filter_func filter,
                                  void *user_data);

### raptor_parser_get_world ()

    raptor_world *
    raptor_parser_get_world (raptor_parser *rdf_parser);

#### Returns

## Types and Values

### raptor_parser

    raptor_parser* raptor_parser;

Raptor Parser class

### enum raptor_graph_mark_flags

Graph mark handler bitmask flags

#### Members

RAPTOR_GRAPH_MARK_START | mark is start of graph (otherwise is end) |
RAPTOR_GRAPH_MARK_DECLARED | mark was declared in syntax rather than implict |