Raptor RDF Syntax Parsing and Serializing Library Manual | ||||
---|---|---|---|---|
Top | Description |
extern const unsigned int raptor_version_major; extern const unsigned int raptor_version_minor; extern const unsigned int raptor_version_release; extern const unsigned int raptor_version_decimal; void (*raptor_simple_message_handler) (void *user_data, const char *message, ...); void (*raptor_message_handler) (void *user_data, raptor_locator *locator, const char *message); void (*raptor_statement_handler) (void *user_data, const raptor_statement *statement); int raptor_parsers_enumerate (unsigned int counter, const char **name, const char **label); int raptor_syntaxes_enumerate (unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string); int raptor_syntax_name_check (const char *name); const char* raptor_guess_parser_name (raptor_uri *uri, const char *mime_type, unsigned char *buffer, size_t len, unsigned char *identifier); int raptor_serializers_enumerate (unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string); int raptor_serializer_syntax_name_check (const char *name); int raptor_print_ntriples_string (FILE *stream, unsigned char *string, const char delim); unsigned char* raptor_ntriples_string_as_utf8_string (raptor_parser *rdf_parser, unsigned char *src, int len, size_t *dest_lenp); const char* raptor_ntriples_term_as_string (raptor_ntriples_term_type term); char* raptor_vsnprintf (const char *message); enum raptor_log_level; raptor_message_handler_closure; raptor_error_handlers; void raptor_error_handlers_init (raptor_error_handlers *error_handlers); void raptor_set_libxml_flags (int flags); void raptor_set_libxslt_security_preferences (void *security_preferences);
How to get access to version numbers, set message and error handlers, list the parsed and serialized syntaxes provided in the library and various other utility functions.
extern const unsigned int raptor_version_major;
Library major version number as a decimal integer.
extern const unsigned int raptor_version_minor;
Library minor version number as a decimal integer.
extern const unsigned int raptor_version_release;
Library release version number as a decimal integer.
extern const unsigned int raptor_version_decimal;
Library full version as a decimal integer.
See also raptor_version_string.
void (*raptor_simple_message_handler) (void *user_data, const char *message, ...);
Simple message handler function.
Used by multiple functions including raptor_xml_escape_string()
,
raptor_iostream_write_xml_escaped_string()
, raptor_new_qname()
,
raptor_qname_string_to_uri()
, raptor_new_namespaces()
,
raptor_namespaces_init()
, raptor_iostream_write_xml_element()
,
raptor_new_xml_writer()
.
|
user data |
|
message to report |
|
arguments for message |
void (*raptor_message_handler) (void *user_data, raptor_locator *locator, const char *message);
Message with location handler function.
Used during parsing and serializing for errors and warnings that
may include location information. Multiple handlers may be set for
parsers and serializers by raptor_set_fatal_error_handler()
,
raptor_set_error_handler()
, raptor_set_warning_handler()
,
raptor_serializer_set_error_handler()
and
raptor_serializer_set_warning_handler()
.
Also used by raptor_www_set_error_handler()
for location-based errors
in WWW retrieval.
|
user data |
|
location associated with message or NULL |
|
message to report |
void (*raptor_statement_handler) (void *user_data, const raptor_statement *statement);
Statement (triple) reporting handler function.
|
user data |
|
statement to report |
int raptor_parsers_enumerate (unsigned int counter, const char **name, const char **label);
Get list of syntax parsers.
|
index to list of parsers |
|
pointer to store syntax name (or NULL) |
|
pointer to store syntax label (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
int raptor_syntaxes_enumerate (unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string);
Get information on syntaxes.
raptor_init()
MUST have been called before calling this function.
Use raptor_syntaxes_enumerate_v2()
if using raptor_world APIs.
|
index into the list of syntaxes |
|
pointer to store the name of the syntax (or NULL) |
|
pointer to store syntax readable label (or NULL) |
|
pointer to store syntax MIME Type (or NULL) |
|
pointer to store syntax URI string (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
int raptor_syntax_name_check (const char *name);
Check name of a parser.
raptor_init()
MUST have been called before calling this function.
Use raptor_syntax_name_check_v2()
if using raptor_world APIs.
|
the syntax name |
Returns : |
non 0 if name is a known syntax name |
const char* raptor_guess_parser_name (raptor_uri *uri, const char *mime_type, unsigned char *buffer, size_t len, unsigned char *identifier);
Guess a parser name for content.
Find a parser by scoring recognition of the syntax by a block of characters, the content identifier or a mime type. The content identifier is typically a filename or URI or some other identifier.
raptor_init()
MUST have been called before calling this function.
Use raptor_guess_parser_name_v2()
if using raptor_world APIs.
|
URI identifying the syntax (or NULL) |
|
mime type identifying the content (or NULL) |
|
buffer of content to guess (or NULL) |
|
length of buffer |
|
identifier of content (or NULL) |
Returns : |
a parser name or NULL if no guess could be made |
int raptor_serializers_enumerate (unsigned int counter, const char **name, const char **label, const char **mime_type, unsigned char **uri_string);
Get information on syntax serializers.
raptor_init()
MUST have been called before calling this function.
Use raptor_serializers_enumerate_v2()
if using raptor_world APIs.
|
index into the list of syntaxes |
|
pointer to store the name of the syntax (or NULL) |
|
pointer to store syntax readable label (or NULL) |
|
pointer to store syntax MIME Type (or NULL) |
|
pointer to store syntax URI string (or NULL) |
Returns : |
non 0 on failure of if counter is out of range |
int raptor_serializer_syntax_name_check (const char *name);
Check name of a serializer.
raptor_init()
MUST have been called before calling this function.
Use raptor_serializer_syntax_name_check_v2()
if using raptor_world APIs.
|
the syntax name |
Returns : |
non 0 if name is a known syntax name |
int raptor_print_ntriples_string (FILE *stream, unsigned char *string, const char delim);
Print an UTF-8 string using N-Triples escapes.
|
FILE* stream to print to |
|
UTF-8 string to print |
|
Delimiter character for string (such as ") or \0 for no delim escaping. |
Returns : |
non-0 on failure such as bad UTF-8 encoding. |
unsigned char* raptor_ntriples_string_as_utf8_string (raptor_parser *rdf_parser, unsigned char *src, int len, size_t *dest_lenp);
raptor_ntriples_string_as_utf8_string
is deprecated and should not be used in newly-written code.
Turn an N-Triples string with escapes into a UTF-8 string.
deprecated
: This requires use of parser internals and was never in the public API header.
|
parser object |
|
data to read from |
|
size of data |
|
pointer to length of destination (out) or NULL |
Returns : |
a new UTF-8 string |
const char* raptor_ntriples_term_as_string (raptor_ntriples_term_type term);
raptor_ntriples_term_as_string
is deprecated and should not be used in newly-written code.
Get a label for a raptor_ntriples_term_type.
deprecated
: an internal debug function, do not use.
|
N-Triples term. |
Returns : |
a pointer to a constant string. |
char* raptor_vsnprintf (const char *message);
Format output for a variable arguments list.
This is a wrapper around system versions of vsnprintf with different call and return conventions.
|
printf-style format string |
Returns : |
a newly allocated string as the format result or NULL on failure |
typedef enum { RAPTOR_LOG_LEVEL_NONE, RAPTOR_LOG_LEVEL_FATAL, RAPTOR_LOG_LEVEL_ERROR, RAPTOR_LOG_LEVEL_WARNING, /* RAPTOR V2 FIXME - this enum list cannot be extended before V2 * API is released else binary compatibility will be broken in the * #raptor_error_handlers structure - it causes an array to grow. */ RAPTOR_LOG_LEVEL_LAST=RAPTOR_LOG_LEVEL_WARNING } raptor_log_level;
Log levels
typedef struct { void *user_data; raptor_message_handler handler; } raptor_message_handler_closure;
The combination of a message handler and the user data to send to it.
user data for handler invocation | |
raptor_message_handler |
handler function |
typedef struct { unsigned int magic; raptor_locator* locator; /* size of handlers array */ raptor_log_level last_log_level; raptor_message_handler_closure handlers[RAPTOR_LOG_LEVEL_LAST+1]; /* Raptor V2 FIXME - this should NOT be at the end of the structure * since it prevents increasing the size of the @handlers array but * it it is here to preserve Raptor V1 ABI. */ raptor_world *world; } raptor_error_handlers;
Error handlers structure
magic value - must use raptor_error_handlers_init() to set this
|
|
raptor_locator * |
raptor locator of the error |
raptor_log_level |
number of log levels; size of handlers arrays
|
raptor_message_handler_closure |
user handlers per log level |
raptor_world * |
raptor_world object |
void raptor_error_handlers_init (raptor_error_handlers *error_handlers);
Initialize raptor_error_handlers object statically.
raptor_init()
MUST have been called before calling this function.
Use raptor_error_handlers_init_v2()
if using raptor_world APIs.
|
error handlers object |
void raptor_set_libxml_flags (int flags);
Set common libxml library flags
If libxml is compiled into the library, flags
is a bitmask
taking an OR of values defined in raptor_libxml_flags
See the raptor_libxml_flags documentation for full details of what the flags mean.
|
flags |
void raptor_set_libxslt_security_preferences (void *security_preferences);
Set libxslt security preferences policy object
The security_preferences
object will NOT become owned by Raptor
If libxslt is compiled into the library, security_preferences
should be an xsltSecurityPrefsPtr and will be used to call
xsltSetCtxtSecurityPrefs()
when an XSLT engine is initialised.
If libxslt is not compiled in, the object set here is not used.
|
security preferences (an xsltSecurityPrefsPtr) |
Navigation: Redland Home Page