|Raptor RDF Syntax Parsing and Serializing Library Manual|
The parser can be created directly from a known name such as
rdfxml for the W3C Recommendation RDF/XML syntax:
raptor_parser* rdf_parser; rdf_parser = raptor_new_parser("rdfxml");
or the name can be discovered from an enumeration as discussed in Querying Functionality
The parser can also be created by identifying the syntax by a
URI, specifying the syntax by a MIME Type, providng an identifier for
the content such as filename or URI string or giving some initial
content bytes that can be used to guess.
function, all of these can be given as optional parameters, using NULL
or 0 for undefined parameters. The constructor will then use as much of
this information as possible.
Create a parser that reads the MIME Type for RDF/XML
rdf_parser = raptor_new_parser_for_content(NULL, "application/rdf+xml", NULL, 0, NULL);
Create a parser that can read a syntax identified by the URI
which has no registered MIME Type at this date:
syntax_uri = raptor_new_uri("http://www.dajobe.org/2004/01/turtle/"); rdf_parser = raptor_new_parser_for_content(syntax_uri, NULL, NULL, 0, NULL);
Create a parser that recognises the identifier
rdf_parser = raptor_new_parser_for_content(NULL, NULL, NULL, 0, "foo.rss");
Create a parser that recognises the content in buffer:
rdf_parser = raptor_new_parser_for_content(NULL, NULL, buffer, len, NULL);
Any of the constructor calls can return NULL if no matching parser could be found, or the construction failed in another way.