raptor.h   raptor.h 
/* -*- Mode: c; c-basic-offset: 2 -*- /* -*- Mode: c; c-basic-offset: 2 -*-
* *
* raptor.h - Redland Parser Toolkit for RDF (Raptor) interfaces and defini tion * raptor.h - Redland Parser Toolkit for RDF (Raptor) - public API
* *
* Copyright (C) 2000-2008, David Beckett http://www.dajobe.org/ * Copyright (C) 2000-2010, David Beckett http://www.dajobe.org/
* Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac .uk/ * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac .uk/
* *
* This package is Free Software and part of Redland http://librdf.org/ * This package is Free Software and part of Redland http://librdf.org/
* *
* It is licensed under the following three licenses as alternatives: * It is licensed under the following three licenses as alternatives:
* 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
* 2. GNU General Public License (GPL) V2 or any newer version * 2. GNU General Public License (GPL) V2 or any newer version
* 3. Apache License, V2.0 or any newer version * 3. Apache License, V2.0 or any newer version
* *
* You may not use this file except in compliance with at least one of * You may not use this file except in compliance with at least one of
skipping to change at line 38 skipping to change at line 38
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdio.h> #include <stdio.h>
/* Required for va_list in raptor_vsnprintf */ /* Required for va_list in raptor_vsnprintf */
#include <stdarg.h> #include <stdarg.h>
/** /**
* RAPTOR_V2_AVAILABLE
*
* Flag for marking raptor2 API availability.
*/
#define RAPTOR_V2_AVAILABLE 1
/**
* RAPTOR_API: * RAPTOR_API:
* *
* Macro for wrapping API function call declarations. * Macro for wrapping API function call declarations.
* *
*/ */
#ifndef RAPTOR_API #ifndef RAPTOR_API
# ifdef WIN32 # ifdef WIN32
# ifdef __GNUC__ # ifdef __GNUC__
# undef _declspec # undef _declspec
# define _declspec(x) __declspec(x) # define _declspec(x) __declspec(x)
skipping to change at line 66 skipping to change at line 73
# endif # endif
# endif # endif
# else # else
# define RAPTOR_API # define RAPTOR_API
# endif # endif
#endif #endif
/* Use gcc 3.1+ feature to allow marking of deprecated API calls. /* Use gcc 3.1+ feature to allow marking of deprecated API calls.
* This gives a warning during compiling. * This gives a warning during compiling.
*/ */
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3 #if( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
#ifdef __APPLE_CC__ #ifdef __APPLE_CC__
/* OSX gcc cpp-precomp is broken */ /* OSX gcc cpp-precomp is broken */
#define RAPTOR_DEPRECATED #define RAPTOR_DEPRECATED
#else #else
#define RAPTOR_DEPRECATED __attribute__((deprecated)) #define RAPTOR_DEPRECATED __attribute__((deprecated))
#endif #endif
#else #else
#define RAPTOR_DEPRECATED #define RAPTOR_DEPRECATED
#endif #endif
/** /**
* RAPTOR_V2_EXPERIMENTAL:
*
* Enable EXPERIMENTAL and UNSUPPORTED API v2 structs and functions
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
* The v2 structs and raptor*_v2() functions are NOT supported.
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*/
#undef RAPTOR_V2_AVAILABLE
#ifdef RAPTOR_V2_EXPERIMENTAL
#define RAPTOR_V2_AVAILABLE 1
#endif
/* Allow to flag V1 functions as deprecated */
#ifndef RAPTOR_V1
#define RAPTOR_V1
#endif
/**
* RAPTOR_PRINTF_FORMAT: * RAPTOR_PRINTF_FORMAT:
* @string_index: ignore me * @string_index: ignore me
* @first_to_check_index: ignore me * @first_to_check_index: ignore me
* *
* Internal macro * Internal macro
*/ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index) \ #define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index) \
__attribute__((__format__(__printf__, string_index, first_to_check_index) )) __attribute__((__format__(__printf__, string_index, first_to_check_index) ))
#else #else
#define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index) #define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index)
#endif #endif
/** /**
* raptor_uri: * raptor_uri:
* *
* Raptor URI Class. * Raptor URI Class.
*/ */
typedef void* raptor_uri; typedef struct raptor_uri_s raptor_uri;
/* Public statics */ /* Public statics */
RAPTOR_API RAPTOR_API
extern const char * const raptor_short_copyright_string; extern const char * const raptor_short_copyright_string;
RAPTOR_API RAPTOR_API
extern const char * const raptor_copyright_string; extern const char * const raptor_copyright_string;
RAPTOR_API RAPTOR_API
extern const char * const raptor_version_string; extern const char * const raptor_version_string;
RAPTOR_API RAPTOR_API
extern const unsigned int raptor_version_major; extern const unsigned int raptor_version_major;
skipping to change at line 170 skipping to change at line 156
/** /**
* raptor_xml_literal_datatype_uri_string_len: * raptor_xml_literal_datatype_uri_string_len:
* *
* Length of #raptor_xml_literal_datatype_uri_string * Length of #raptor_xml_literal_datatype_uri_string
*/ */
RAPTOR_API RAPTOR_API
extern const unsigned int raptor_xml_literal_datatype_uri_string_len; extern const unsigned int raptor_xml_literal_datatype_uri_string_len;
/* Public structure */ /* Public structure */
#ifndef RAPTOR_WORLD_DECLARED
#define RAPTOR_WORLD_DECLARED 1
/** /**
* raptor_world: * raptor_world:
* *
* Raptor world class. * Raptor world class.
*/ */
typedef struct raptor_world_s raptor_world; typedef struct raptor_world_s raptor_world;
#endif
/** /**
* raptor_parser: * raptor_parser:
* *
* Raptor Parser class * Raptor Parser class
*/ */
typedef struct raptor_parser_s raptor_parser; typedef struct raptor_parser_s raptor_parser;
/** /**
* raptor_serializer: * raptor_serializer:
* *
* Raptor Serializer class * Raptor Serializer class
skipping to change at line 236 skipping to change at line 219
*/ */
typedef struct raptor_namespace_s raptor_namespace; typedef struct raptor_namespace_s raptor_namespace;
/** /**
* raptor_namespace_stack: * raptor_namespace_stack:
* *
* Raptor XML Namespace Stack class * Raptor XML Namespace Stack class
*/ */
typedef struct raptor_namespace_stack_s raptor_namespace_stack; typedef struct raptor_namespace_stack_s raptor_namespace_stack;
/** /**
* raptor_ntriples_parser:
*
* @Deprecated: use #raptor_parser.
*
* old structure - use #raptor_parser instead.
*/
typedef raptor_parser raptor_ntriples_parser;
/**
* raptor_sax2: * raptor_sax2:
* *
* Raptor SAX2 class * Raptor SAX2 class
*/ */
typedef struct raptor_sax2_s raptor_sax2; typedef struct raptor_sax2_s raptor_sax2;
/** /**
* raptor_identifier_type: * raptor_type_q:
* @RAPTOR_IDENTIFIER_TYPE_RESOURCE: Resource URI (e.g. <literal>rdf:abo * @mime_type: MIME type string
ut</literal>) * @mime_type_len: length of @mime_type
* @RAPTOR_IDENTIFIER_TYPE_ANONYMOUS: <literal>_:foo</literal> N-Triples, * @q: Q value 0-10 standing for decimal 0.0-1.0
or generated
* @RAPTOR_IDENTIFIER_TYPE_PREDICATE: predicate URI. WARNING: Will not b
e generated in in Raptor 1.4.9 or newer. Instead a #RAPTOR_IDENTIFIER_TYPE
_RESOURCE will be returned.
* @RAPTOR_IDENTIFIER_TYPE_ORDINAL: <literal>rdf:li</literal>, <literal
>rdf:_</literal><emphasis>n</emphasis>. No longer generated in any parser
in Raptor 1.4.10+, instead a #RAPTOR_IDENTIFIER_TYPE_RESOURCE is returned.
* @RAPTOR_IDENTIFIER_TYPE_LITERAL: regular literal
* @RAPTOR_IDENTIFIER_TYPE_XML_LITERAL: <literal>rdf:parseType="Literal"</l
iteral>. No longer generated by any parser in Raptor 1.4.8+, instead a #RA
PTOR_IDENTIFIER_TYPE_LITERAL is returned with a datatype of <literal>rdf:XM
LLiteral</literal>.
* @RAPTOR_IDENTIFIER_TYPE_UNKNOWN: Internal
* *
* Type of identifier in a #raptor_statement * (MIME Type, Q) pair
*/
typedef struct {
const char* mime_type;
size_t mime_type_len;
unsigned char q;
} raptor_type_q;
/**
* raptor_syntax_bitflags:
* @RAPTOR_SYNTAX_NEED_BASE_URI: the syntax requires a base URI
* *
* Bit flags for #raptor_syntax_description flags field
*/ */
typedef enum { typedef enum {
RAPTOR_IDENTIFIER_TYPE_UNKNOWN, RAPTOR_SYNTAX_NEED_BASE_URI = 1
RAPTOR_IDENTIFIER_TYPE_RESOURCE, } raptor_syntax_bitflags;
RAPTOR_IDENTIFIER_TYPE_ANONYMOUS,
RAPTOR_IDENTIFIER_TYPE_PREDICATE,
RAPTOR_IDENTIFIER_TYPE_ORDINAL,
RAPTOR_IDENTIFIER_TYPE_LITERAL,
RAPTOR_IDENTIFIER_TYPE_XML_LITERAL
} raptor_identifier_type;
/** /**
* raptor_uri_source: * raptor_syntax_description:
* @RAPTOR_URI_SOURCE_UNKNOWN: Internal * @names: array of syntax names - the first one (required) is the public n
* @RAPTOR_URI_SOURCE_NOT_URI: Internal ame, the rest are aliases. The array is NULL terminated.
* @RAPTOR_URI_SOURCE_ELEMENT: Internal * @label: long descriptive label for syntax
* @RAPTOR_URI_SOURCE_ATTRIBUTE: Internal * @mime_types: Array of (MIME type, Q) values associated with the syntax (
* @RAPTOR_URI_SOURCE_ID: Internal or NULL). If present the array is NULL terminated.
* @RAPTOR_URI_SOURCE_URI: Internal * @mime_types_count: size of @mime_types array (or 0)
* @RAPTOR_URI_SOURCE_GENERATED: Internal * @uri_string: URI identifying the syntax (or NULL)
* @RAPTOR_URI_SOURCE_BLANK_ID: Internal * @flags: See #raptor_syntax_bitflags for the bits
* *
* Internal: Where a URI or identifier was derived from * Description of a syntax or file format.
* *
* Likely to be deprecated in future releases.
*/ */
typedef struct {
const char* const* names;
typedef enum { RAPTOR_URI_SOURCE_UNKNOWN, RAPTOR_URI_SOURCE_NOT_URI, RAPTOR const char* label;
_URI_SOURCE_ELEMENT, RAPTOR_URI_SOURCE_ATTRIBUTE, RAPTOR_URI_SOURCE_ID, RAP
TOR_URI_SOURCE_URI, RAPTOR_URI_SOURCE_GENERATED, RAPTOR_URI_SOURCE_BLANK_ID const raptor_type_q* mime_types;
} raptor_uri_source; unsigned int mime_types_count;
const char* uri_string;
unsigned int flags;
} raptor_syntax_description;
/** /**
* raptor_ntriples_term_type: * raptor_term_type:
* @RAPTOR_NTRIPLES_TERM_TYPE_URI_REF: Internal * @RAPTOR_TERM_TYPE_URI: RDF URI
* @RAPTOR_NTRIPLES_TERM_TYPE_BLANK_NODE: Internal * @RAPTOR_TERM_TYPE_LITERAL: RDF literal
* @RAPTOR_NTRIPLES_TERM_TYPE_LITERAL: I * @RAPTOR_TERM_TYPE_BLANK: RDF blank node
* * @RAPTOR_TERM_TYPE_UNKNOWN: Internal
* N-Triples term types
* *
* Used for the deprecated function raptor_ntriples_term_as_string() only. * Type of term in a #raptor_statement
* *
* Node type 3 is unused but exists to preserve numeric compatibility
* with librdf_node_type values.
*/ */
typedef enum { RAPTOR_NTRIPLES_TERM_TYPE_URI_REF, RAPTOR_NTRIPLES_TERM_TYPE typedef enum {
_BLANK_NODE, RAPTOR_NTRIPLES_TERM_TYPE_LITERAL } raptor_ntriples_term_type; RAPTOR_TERM_TYPE_UNKNOWN = 0,
RAPTOR_TERM_TYPE_URI = 1,
RAPTOR_TERM_TYPE_LITERAL = 2,
/* unused type 3 */
RAPTOR_TERM_TYPE_BLANK = 4
} raptor_term_type;
/** /**
* raptor_locator: * raptor_locator:
* @uri: URI of location (or NULL) * @uri: URI of location (or NULL)
* @file: Filename of location (or NULL) * @file: Filename of location (or NULL)
* @line: Line number of location (or <0 for no line) * @line: Line number of location (or <0 for no line)
* @column: Column number of location (or <0 for no column) * @column: Column number of location (or <0 for no column)
* @byte: Byte number of location (or <0 for no byte) * @byte: Byte number of location (or <0 for no byte)
* *
* Location information for an error, warning or information message. * Location information for an error, warning or information message.
*/ */
typedef struct { typedef struct {
raptor_uri *uri; raptor_uri *uri;
const char *file; const char *file;
int line; int line;
int column; int column;
int byte; int byte;
} raptor_locator; } raptor_locator;
/** /**
* raptor_feature: * raptor_option:
* @RAPTOR_FEATURE_SCANNING: If true (default false), the RDF/XML * @RAPTOR_OPTION_SCANNING: If true (default false), the RDF/XML
* parser will look for embedded rdf:RDF elements inside the XML * parser will look for embedded rdf:RDF elements inside the XML
* content, and not require that the XML start with an rdf:RDF root * content, and not require that the XML start with an rdf:RDF root
* element. * element.
* @RAPTOR_FEATURE_ASSUME_IS_RDF: If true (default false) then the * @RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES: If true (default true)
* RDF/XML parser will assume the content is RDF/XML, not require
* that rdf:RDF root element, and immediately interpret the content
* as RDF/XML.
* @RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES: If true (default true)
* then the RDF/XML parser will allow non-XML namespaced attributes * then the RDF/XML parser will allow non-XML namespaced attributes
* to be accepted as well as rdf: namespaced ones. For example, * to be accepted as well as rdf: namespaced ones. For example,
* 'about' and 'ID' will be interpreted as if they were rdf:about * 'about' and 'ID' will be interpreted as if they were rdf:about
* and rdf:ID respectively. * and rdf:ID respectively.
* @RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES: If true (default true) * @RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES: If true (default true)
* then the RDF/XML parser will allow unknown parsetypes to be * then the RDF/XML parser will allow unknown parsetypes to be
* present and will pass them on to the user. Unimplemented at * present and will pass them on to the user. Unimplemented at
* present. * present.
* @RAPTOR_FEATURE_ALLOW_BAGID: If true (default true) then the * @RAPTOR_OPTION_ALLOW_BAGID: If true (default true) then the
* RDF/XML parser will support the rdf:bagID attribute that was * RDF/XML parser will support the rdf:bagID attribute that was
* removed from the RDF/XML language when it was revised. This * removed from the RDF/XML language when it was revised. This
* support may be removed in future. * support may be removed in future.
* @RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST: If true (default false) * @RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST: If true (default false)
* then the RDF/XML parser will generate the idList rdf:type * then the RDF/XML parser will generate the idList rdf:type
* rdf:List triple in the handling of rdf:parseType="Collection". * rdf:List triple in the handling of rdf:parseType="Collection".
* This triple was removed during the revising of RDF/XML after * This triple was removed during the revising of RDF/XML after
* collections were initially added. * collections were initially added.
* @RAPTOR_FEATURE_NORMALIZE_LANGUAGE: If true (default true) then * @RAPTOR_OPTION_NORMALIZE_LANGUAGE: If true (default true) then
* XML language values such as from xml:lang will be normalized to * XML language values such as from xml:lang will be normalized to
* lowercase. * lowercase.
* @RAPTOR_FEATURE_NON_NFC_FATAL: If true (default false) then * @RAPTOR_OPTION_NON_NFC_FATAL: If true (default false) then
* illegal Unicode Normal Form C in literals will give a fatal * illegal Unicode Normal Form C in literals will give a fatal
* error, otherwise just a warning. * error, otherwise just a warning.
* @RAPTOR_FEATURE_WARN_OTHER_PARSETYPES: If true (default true) then * @RAPTOR_OPTION_WARN_OTHER_PARSETYPES: If true (default true) then
* the RDF/XML parser will warn about unknown rdf:parseType values. * the RDF/XML parser will warn about unknown rdf:parseType values.
* @RAPTOR_FEATURE_CHECK_RDF_ID: If true (default true) then the * @RAPTOR_OPTION_CHECK_RDF_ID: If true (default true) then the
* RDF/XML will check rdf:ID attribute values for duplicates and * RDF/XML will check rdf:ID attribute values for duplicates and
* cause an error if any are found. * cause an error if any are found.
* @RAPTOR_FEATURE_RELATIVE_URIS: If true (default true) then * @RAPTOR_OPTION_RELATIVE_URIS: If true (default true) then
* relative URIs will be used wherever possible when serializing. * relative URIs will be used wherever possible when serializing.
* @RAPTOR_FEATURE_START_URI: Set the start URI for serlalizing to use. * @RAPTOR_OPTION_WRITER_AUTO_INDENT: Automatically indent elements when
* @RAPTOR_FEATURE_WRITER_AUTO_INDENT: Automatically indent elements when
* seriailizing. * seriailizing.
* @RAPTOR_FEATURE_WRITER_AUTO_EMPTY: Automatically detect and * @RAPTOR_OPTION_WRITER_AUTO_EMPTY: Automatically detect and
* abbreviate empty elements when serializing. * abbreviate empty elements when serializing.
* @RAPTOR_FEATURE_WRITER_INDENT_WIDTH: Integer number of spaces to use * @RAPTOR_OPTION_WRITER_INDENT_WIDTH: Integer number of spaces to use
* for each indent level when serializing with auto indent. * for each indent level when serializing with auto indent.
* @RAPTOR_FEATURE_WRITER_XML_VERSION: Integer XML version XML 1.0 (10) or * @RAPTOR_OPTION_WRITER_XML_VERSION: Integer XML version XML 1.0 (10) or X
XML 1.1 (11) ML 1.1 (11)
* @RAPTOR_FEATURE_WRITER_XML_DECLARATION: Write XML 1.0 or 1.1 declaration * @RAPTOR_OPTION_WRITER_XML_DECLARATION: Write XML 1.0 or 1.1 declaration.
. * @RAPTOR_OPTION_NO_NET: Deny network requests.
* @RAPTOR_FEATURE_NO_NET: Deny network requests. * @RAPTOR_OPTION_RESOURCE_BORDER: Border color of resource
* @RAPTOR_FEATURE_RESOURCE_BORDER: Border color of resource
* nodes for GraphViz DOT serializer. * nodes for GraphViz DOT serializer.
* @RAPTOR_FEATURE_LITERAL_BORDER: Border color of literal nodes * @RAPTOR_OPTION_LITERAL_BORDER: Border color of literal nodes
* for GraphViz DOT serializer. * for GraphViz DOT serializer.
* @RAPTOR_FEATURE_BNODE_BORDER: Border color of blank nodes for * @RAPTOR_OPTION_BNODE_BORDER: Border color of blank nodes for
* GraphViz DOT serializer. * GraphViz DOT serializer.
* @RAPTOR_FEATURE_RESOURCE_FILL: Fill color of resource nodes * @RAPTOR_OPTION_RESOURCE_FILL: Fill color of resource nodes
* for GraphViz DOT serializer. * for GraphViz DOT serializer.
* @RAPTOR_FEATURE_LITERAL_FILL: Fill color of literal nodes for * @RAPTOR_OPTION_LITERAL_FILL: Fill color of literal nodes for
* GraphViz DOT serializer. * GraphViz DOT serializer.
* @RAPTOR_FEATURE_BNODE_FILL: Fill color of blank nodes for * @RAPTOR_OPTION_BNODE_FILL: Fill color of blank nodes for
* GraphViz DOT serializer. * GraphViz DOT serializer.
* @RAPTOR_FEATURE_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser * @RAPTOR_OPTION_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser
* fails when read HTML for GRDDL parser. * fails when read HTML for GRDDL parser.
* @RAPTOR_FEATURE_MICROFORMATS: Look for microformats for GRDDL parser. * @RAPTOR_OPTION_MICROFORMATS: Look for microformats for GRDDL parser.
* @RAPTOR_FEATURE_HTML_LINK: Look for head &lt;link&gt; to type rdf/xml * @RAPTOR_OPTION_HTML_LINK: Look for head &lt;link&gt; to type rdf/xml
* for GRDDL parser. * for GRDDL parser.
* @RAPTOR_FEATURE_WWW_TIMEOUT: Set timeout for internal WWW URI requests * @RAPTOR_OPTION_WWW_TIMEOUT: Set timeout for internal WWW URI requests
* for GRDDL parser. * for GRDDL parser.
* @RAPTOR_FEATURE_WRITE_BASE_URI: Write @base directive for Turtle/N3. * @RAPTOR_OPTION_WRITE_BASE_URI: Write @base directive for Turtle/N3.
* @RAPTOR_FEATURE_WWW_HTTP_CACHE_CONTROL: HTTP Cache-Control: header * @RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL: HTTP Cache-Control: header
* @RAPTOR_FEATURE_WWW_HTTP_USER_AGENT: HTTP User-Agent: header * @RAPTOR_OPTION_WWW_HTTP_USER_AGENT: HTTP User-Agent: header
* @RAPTOR_FEATURE_JSON_CALLBACK: JSON serializer callback function. * @RAPTOR_OPTION_JSON_CALLBACK: JSON serializer callback function.
* @RAPTOR_FEATURE_JSON_EXTRA_DATA: JSON serializer extra top-level data * @RAPTOR_OPTION_JSON_EXTRA_DATA: JSON serializer extra top-level data
* @RAPTOR_FEATURE_RSS_TRIPLES: Atom/RSS serializer writes extra RDF triple * @RAPTOR_OPTION_RSS_TRIPLES: Atom/RSS serializer writes extra RDF triples
s it finds (none, rdf-xml, atom-triples) it finds (none, rdf-xml, atom-triples)
* @RAPTOR_FEATURE_ATOM_ENTRY_URI: Atom entry URI. If given, generate an A * @RAPTOR_OPTION_ATOM_ENTRY_URI: Atom entry URI. If given, generate an At
tom Entry Document with the item having the given URI, otherwise generate a om Entry Document with the item having the given URI, otherwise generate an
n Atom Feed Document with any items found. Atom Feed Document with any items found.
* @RAPTOR_FEATURE_PREFIX_ELEMENTS: Integer. If set, generate Atom/RSS1.0 d * @RAPTOR_OPTION_PREFIX_ELEMENTS: Integer. If set, generate Atom/RSS1.0 do
ocuments with prefixed elements, otherwise unprefixed. cuments with prefixed elements, otherwise unprefixed.
* @RAPTOR_FEATURE_LAST: Internal * @RAPTOR_OPTION_STRICT: Boolean. If set, operate in strict conformance mo
* de.
* Raptor parser, serializer or XML writer features. * @RAPTOR_OPTION_LAST: Internal
*/
typedef enum {
RAPTOR_FEATURE_SCANNING,
RAPTOR_FEATURE_ASSUME_IS_RDF,
RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES,
RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES,
RAPTOR_FEATURE_ALLOW_BAGID,
RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST,
RAPTOR_FEATURE_NORMALIZE_LANGUAGE,
RAPTOR_FEATURE_NON_NFC_FATAL,
RAPTOR_FEATURE_WARN_OTHER_PARSETYPES,
RAPTOR_FEATURE_CHECK_RDF_ID,
RAPTOR_FEATURE_RELATIVE_URIS,
RAPTOR_FEATURE_START_URI,
RAPTOR_FEATURE_WRITER_AUTO_INDENT,
RAPTOR_FEATURE_WRITER_AUTO_EMPTY,
RAPTOR_FEATURE_WRITER_INDENT_WIDTH,
RAPTOR_FEATURE_WRITER_XML_VERSION,
RAPTOR_FEATURE_WRITER_XML_DECLARATION,
RAPTOR_FEATURE_NO_NET,
RAPTOR_FEATURE_RESOURCE_BORDER,
RAPTOR_FEATURE_LITERAL_BORDER,
RAPTOR_FEATURE_BNODE_BORDER,
RAPTOR_FEATURE_RESOURCE_FILL,
RAPTOR_FEATURE_LITERAL_FILL,
RAPTOR_FEATURE_BNODE_FILL,
RAPTOR_FEATURE_HTML_TAG_SOUP,
RAPTOR_FEATURE_MICROFORMATS,
RAPTOR_FEATURE_HTML_LINK,
RAPTOR_FEATURE_WWW_TIMEOUT,
RAPTOR_FEATURE_WRITE_BASE_URI,
RAPTOR_FEATURE_WWW_HTTP_CACHE_CONTROL,
RAPTOR_FEATURE_WWW_HTTP_USER_AGENT,
RAPTOR_FEATURE_JSON_CALLBACK,
RAPTOR_FEATURE_JSON_EXTRA_DATA,
RAPTOR_FEATURE_RSS_TRIPLES,
RAPTOR_FEATURE_ATOM_ENTRY_URI,
RAPTOR_FEATURE_PREFIX_ELEMENTS,
RAPTOR_FEATURE_LAST = RAPTOR_FEATURE_PREFIX_ELEMENTS
} raptor_feature;
/**
* raptor_genid_type:
* @RAPTOR_GENID_TYPE_BNODEID: Generated ID is for a blank node
* @RAPTOR_GENID_TYPE_BAGID: Generated ID is for rdf:bagID
* *
* Intended type for a generated identifier asked for by the handler * Raptor parser, serializer or XML writer options.
* registered with raptor_set_generate_id_handler().
*/ */
typedef enum { typedef enum {
RAPTOR_GENID_TYPE_BNODEID, RAPTOR_OPTION_SCANNING,
RAPTOR_GENID_TYPE_BAGID RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES,
} raptor_genid_type; RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES,
RAPTOR_OPTION_ALLOW_BAGID,
/** RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST,
* raptor_identifier: RAPTOR_OPTION_NORMALIZE_LANGUAGE,
* @type: Type of identifier RAPTOR_OPTION_NON_NFC_FATAL,
* @uri: URI of identifier for types %RAPTOR_IDENTIFIER_TYPE_RESOURCE and RAPTOR_OPTION_WARN_OTHER_PARSETYPES,
* %RAPTOR_IDENTIFIER_TYPE_PREDICATE RAPTOR_OPTION_CHECK_RDF_ID,
* @uri_source: where the identifier (URI or blank node) came from RAPTOR_OPTION_RELATIVE_URIS,
* @id: blank node identifier for type %RAPTOR_IDENTIFIER_TYPE_ANONYMOUS RAPTOR_OPTION_WRITER_AUTO_INDENT,
* @ordinal: integer ordinal for type %RAPTOR_IDENTIFIER_TYPE_ORDINAL RAPTOR_OPTION_WRITER_AUTO_EMPTY,
* @is_malloced: internal RAPTOR_OPTION_WRITER_INDENT_WIDTH,
* @literal: literal string for types %RAPTOR_IDENTIFIER_TYPE_LITERAL and RAPTOR_OPTION_WRITER_XML_VERSION,
* %RAPTOR_IDENTIFIER_TYPE_XML_LITERAL RAPTOR_OPTION_WRITER_XML_DECLARATION,
* @literal_datatype: RDF literal datatype URI for types RAPTOR_OPTION_NO_NET,
* %RAPTOR_IDENTIFIER_TYPE_LITERAL and %RAPTOR_IDENTIFIER_TYPE_XML_LITERA RAPTOR_OPTION_RESOURCE_BORDER,
L RAPTOR_OPTION_LITERAL_BORDER,
* @literal_language: RDF literal language for type RAPTOR_OPTION_BNODE_BORDER,
* %RAPTOR_IDENTIFIER_TYPE_LITERAL RAPTOR_OPTION_RESOURCE_FILL,
* @world: raptor_world object RAPTOR_OPTION_LITERAL_FILL,
* RAPTOR_OPTION_BNODE_FILL,
* Raptor RDF term identifier. RAPTOR_OPTION_HTML_TAG_SOUP,
*/ RAPTOR_OPTION_MICROFORMATS,
typedef struct { RAPTOR_OPTION_HTML_LINK,
raptor_identifier_type type; RAPTOR_OPTION_WWW_TIMEOUT,
raptor_uri *uri; RAPTOR_OPTION_WRITE_BASE_URI,
raptor_uri_source uri_source; RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL,
const unsigned char *id; RAPTOR_OPTION_WWW_HTTP_USER_AGENT,
int ordinal; RAPTOR_OPTION_JSON_CALLBACK,
int is_malloced; RAPTOR_OPTION_JSON_EXTRA_DATA,
const unsigned char *literal; RAPTOR_OPTION_RSS_TRIPLES,
raptor_uri *literal_datatype; RAPTOR_OPTION_ATOM_ENTRY_URI,
const unsigned char *literal_language; RAPTOR_OPTION_PREFIX_ELEMENTS,
raptor_world *world; RAPTOR_OPTION_STRICT,
} raptor_identifier; RAPTOR_OPTION_LAST = RAPTOR_OPTION_STRICT
} raptor_option;
/** /**
* raptor_statement: * raptor_term_literal_value:
* @subject: triple subject data * @string: literal string
* @subject_type: triple subject type * @string_len: length of string
* @predicate: triple predicate data * @datatype: datatype URI (or NULL)
* @predicate_type: triple predicate type * @language: literal language (or NULL)
* @object: triple object literal string * @language_len: length of language
* @object_type: triple object type
* @object_literal_datatype: triple object literal datatype URI (or NULL)
* @object_literal_language: triple object literal language string (or NULL
)
*
* An RDF triple
* *
* See #raptor_identifier for a description of how the fields may be used. * Literal term value - this typedef exists solely for use in #raptor_term
* As returned by a parser statement_handler.
* *
* See also #raptor_statement_v2. * Either @datatype or @language may be non-NULL but not both.
*/ */
typedef struct { typedef struct {
const void *subject; unsigned char *string;
raptor_identifier_type subject_type; unsigned int string_len;
const void *predicate;
raptor_identifier_type predicate_type; raptor_uri *datatype;
const void *object;
raptor_identifier_type object_type; unsigned char *language;
raptor_uri *object_literal_datatype; unsigned char language_len;
const unsigned char *object_literal_language; } raptor_term_literal_value;
} raptor_statement;
#ifdef RAPTOR_V2_AVAILABLE
/** /**
* raptor_statement_v2: * raptor_term_blank_value:
* @world: raptor_world object * @string: literal string
* @s: #raptor_statement * @string_len: length of string
* *
* An RDF triple wrapper for raptor v2 statement API. * Blank term value - this typedef exists solely for use in #raptor_term
* *
* See #raptor_statement.
*/ */
typedef struct { typedef struct {
raptor_world* world; unsigned char *string;
raptor_statement *s; unsigned int string_len;
} raptor_statement_v2; } raptor_term_blank_value;
#endif
/** /**
* raptor_new_uri_func: * raptor_term_value:
* @context: URI context data * @uri: uri value when term type is #RAPTOR_TERM_TYPE_URI
* @uri_string: URI string * @literal: literal value when term type is #RAPTOR_TERM_TYPE_LITERAL
* @blank: blank value when term type is #RAPTOR_TERM_TYPE_BLANK
* *
* Handler function for implementing raptor_new_uri(). * Term value - this typedef exists solely for use in #raptor_term
* *
* Return value: new URI object or NULL on failure **/
*/ typedef union {
typedef raptor_uri* (*raptor_new_uri_func) (void *context, const unsigned c raptor_uri *uri;
har *uri_string);
/** raptor_term_literal_value literal;
* raptor_new_uri_from_uri_local_name_func:
* @context: URI context data
* @uri: URI object
* @local_name: local name string
*
* Handler function for implementing raptor_new_uri_from_uri_local_name().
*
* Return value: new URI object or NULL on failure
*/
typedef raptor_uri* (*raptor_new_uri_from_uri_local_name_func) (void *conte
xt, raptor_uri *uri, const unsigned char *local_name);
/** raptor_term_blank_value blank;
* raptor_new_uri_relative_to_base_func: } raptor_term_value;
* @context: URI context data
* @base_uri: base URI object
* @uri_string: relative URI string
*
* Handler function for implementing raptor_new_uri_relative_to_base().
*
* Return value: new URI object or NULL on failure
*/
typedef raptor_uri* (*raptor_new_uri_relative_to_base_func) (void *context,
raptor_uri *base_uri, const unsigned char *uri_string);
/** /**
* raptor_new_uri_for_rdf_concept_func: * raptor_term:
* @context: URI context data * @world: world
* @name: RDF term * @usage: usage reference count (if >0)
* @type: term type
* @value: term values per type
* *
* Handler function for implementing raptor_new_uri_for_rdf_concept(). * An RDF statement term
* *
* Return value: new URI object or NULL on failure
*/ */
typedef raptor_uri* (*raptor_new_uri_for_rdf_concept_func) (void *context, typedef struct {
const char *name); raptor_world* world;
/** int usage;
* raptor_free_uri_func:
* @context: URI context data
* @uri: URI object
*
* Handler function for implementing raptor_free_uri().
*/
typedef void (*raptor_free_uri_func) (void *context, raptor_uri *uri);
/** raptor_term_type type;
* raptor_uri_equals_func:
* @context: URI context data
* @uri1: URI object 1
* @uri2: URI object 2
*
* Handler function for implementing raptor_uri_equals().
*
* Return value: non-0 if the URIs are equal
*/
typedef int (*raptor_uri_equals_func) (void *context, raptor_uri* uri1, rap
tor_uri* uri2);
/** raptor_term_value value;
* raptor_uri_compare_func:
* @context: URI context data
* @uri1: URI object 1
* @uri2: URI object 2
*
* Handler function for implementing raptor_uri_equals().
*
* Return value: -1 if uri1 < uri2, 0 if equal, 1 if uri1 > uri2
*/
typedef int (*raptor_uri_compare_func) (void *context, raptor_uri* uri1, ra
ptor_uri* uri2);
/** } raptor_term;
* raptor_uri_copy_func:
* @context: URI context data
* @uri: URI object
*
* Handler function for implementing raptor_uri_copy().
*
* Return value: new URI object or NULL on failure
*/
typedef raptor_uri* (*raptor_uri_copy_func) (void *context, raptor_uri *uri
);
/** /**
* raptor_uri_as_string_func: * raptor_statement:
* @context: URI context data * @world: world pointer
* @uri: URI object * @usage: usage count
* @subject: statement subject
* @predicate: statement predicate
* @object: statement object
* @graph: statement graph name (or NULL if not present)
* *
* Handler function for implementing raptor_uri_as_string(). * An RDF triple with optional graph name (quad)
* *
* Return value: shared string representation of the URI * See #raptor_term for a description of how the fields may be used.
* As returned by a parser statement_handler.
*/ */
typedef unsigned char* (*raptor_uri_as_string_func)(void *context, raptor_u typedef struct {
ri *uri); raptor_world* world;
int usage;
raptor_term* subject;
raptor_term* predicate;
raptor_term* object;
raptor_term* graph;
} raptor_statement;
/** /**
* raptor_uri_as_counted_string_func: * raptor_log_level:
* @context: URI context data * @RAPTOR_LOG_LEVEL_NONE: Internal
* @uri: URI object * @RAPTOR_LOG_LEVEL_TRACE: very fine-grained tracing messages information
* @len_p: length * @RAPTOR_LOG_LEVEL_DEBUG: fine-grained tracing messages suitable for debu
* gging
* Handler function for implementing raptor_uri_as_counted_string(). * @RAPTOR_LOG_LEVEL_INFO: coarse-grained information messages
* @RAPTOR_LOG_LEVEL_WARN: warning messages of potentially harmful problems
* @RAPTOR_LOG_LEVEL_ERROR: error messages where the application can contin
ue
* @RAPTOR_LOG_LEVEL_FATAL: fatal error message where the application will
likely abort
* @RAPTOR_LOG_LEVEL_LAST: Internal
* *
* Return value: shared string representation of the URI * Log levels
*/ */
typedef unsigned char* (*raptor_uri_as_counted_string_func)(void *context, typedef enum {
raptor_uri *uri, size_t* len_p); RAPTOR_LOG_LEVEL_NONE,
RAPTOR_LOG_LEVEL_TRACE,
RAPTOR_LOG_LEVEL_DEBUG,
RAPTOR_LOG_LEVEL_INFO,
RAPTOR_LOG_LEVEL_WARN,
RAPTOR_LOG_LEVEL_ERROR,
RAPTOR_LOG_LEVEL_FATAL,
RAPTOR_LOG_LEVEL_LAST = RAPTOR_LOG_LEVEL_FATAL
} raptor_log_level;
/** /**
* raptor_uri_handler: * raptor_domain:
* @new_uri: function for raptor_new_uri() * @RAPTOR_DOMAIN_IOSTREAM: I/O stream
* @new_uri_from_uri_local_name: function for raptor_new_uri_from_uri_local * @RAPTOR_DOMAIN_NAMESPACE: XML Namespace / namespace stack
_name() * @RAPTOR_DOMAIN_PARSER: RDF Parser
* @new_uri_relative_to_base: function for raptor_new_uri_relative_to_base( * @RAPTOR_DOMAIN_QNAME: XML QName
) * @RAPTOR_DOMAIN_SAX2: XML SAX2
* @new_uri_for_rdf_concept: function for raptor_new_uri_for_rdf_concept() * @RAPTOR_DOMAIN_SERIALIZER: RDF Serializer
* @free_uri: function for raptor_free_uri() * @RAPTOR_DOMAIN_TERM: RDF Term
* @uri_equals: function for raptor_uri_equals() * @RAPTOR_DOMAIN_TURTLE_WRITER: Turtle Writer
* @uri_compare: function for raptor_uri_compare() * @RAPTOR_DOMAIN_URI: RDF Uri
* @uri_copy: function for raptor_uri_copy() * @RAPTOR_DOMAIN_WORLD: RDF world
* @uri_as_string: function for raptor_uri_as_string() * @RAPTOR_DOMAIN_WWW: WWW
* @uri_as_counted_string: function for raptor_uri_as_counted_string() * @RAPTOR_DOMAIN_XML_WRITER: XML Writer
* @initialised: API version - set to API version implemented: 1..2 * @RAPTOR_DOMAIN_NONE: Internal
* @RAPTOR_DOMAIN_LAST: Internal
* *
* URI implementation handler structure. * Log domain
*/ */
typedef struct { typedef enum {
/* constructors - URI Interface V1 */ RAPTOR_DOMAIN_NONE,
raptor_new_uri_func new_uri; RAPTOR_DOMAIN_IOSTREAM,
raptor_new_uri_from_uri_local_name_func new_uri_from_uri_local_name; RAPTOR_DOMAIN_NAMESPACE,
raptor_new_uri_relative_to_base_func new_uri_relative_to_base; RAPTOR_DOMAIN_PARSER,
raptor_new_uri_for_rdf_concept_func new_uri_for_rdf_concept; RAPTOR_DOMAIN_QNAME,
/* destructor - URI Interface V1 */ RAPTOR_DOMAIN_SAX2,
raptor_free_uri_func free_uri; RAPTOR_DOMAIN_SERIALIZER,
/* methods - URI Interface V1 */ RAPTOR_DOMAIN_TERM,
raptor_uri_equals_func uri_equals; RAPTOR_DOMAIN_TURTLE_WRITER,
raptor_uri_copy_func uri_copy; /* well, copy construct RAPTOR_DOMAIN_URI,
or */ RAPTOR_DOMAIN_WORLD,
raptor_uri_as_string_func uri_as_string; RAPTOR_DOMAIN_WWW,
raptor_uri_as_counted_string_func uri_as_counted_string; RAPTOR_DOMAIN_XML_WRITER,
int initialised; RAPTOR_DOMAIN_LAST = RAPTOR_DOMAIN_XML_WRITER
/* methods - URI Interface V2 */ } raptor_domain;
raptor_uri_compare_func uri_compare;
} raptor_uri_handler;
/** /**
* raptor_simple_message_handler: * raptor_log_message:
* @user_data: user data * @code: error code or <0
* @message: message to report * @domain: message domain or RAPTOR_DOMAIN_NONE
* @...: arguments for message * @level: log level
* * @locator: location associated with message or NULL
* Simple message handler function. * @text: message string
* *
* Used by multiple functions including raptor_xml_escape_string(), * Log message.
* 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().
*/ */
typedef void (*raptor_simple_message_handler)(void *user_data, const char * typedef struct {
message, ...); int code;
raptor_domain domain;
raptor_log_level level;
raptor_locator *locator;
const char *text;
} raptor_log_message;
/** /**
* raptor_message_handler: * raptor_log_handler:
* @user_data: user data * @user_data: user data
* @locator: location associated with message or NULL * @message: log message
* @message: message to report
* *
* Message with location handler function. * Handler function for log messages with location
* *
* Used during parsing and serializing for errors and warnings that * Used during parsing and serializing for errors and warnings that
* may include location information. Multiple handlers may be set for * may include location information. Handlers may be set
* parsers and serializers by raptor_set_fatal_error_handler(), * by raptor_world_set_log_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.
*/
typedef void (*raptor_message_handler)(void *user_data, raptor_locator* loc
ator, const char *message);
/**
* raptor_message_handler_closure:
* @user_data: user data for handler invocation
* @handler: handler function
* *
* The combination of a message handler and the user data to send to it.
*/ */
typedef struct { typedef void (*raptor_log_handler)(void *user_data, raptor_log_message *mes
void *user_data; sage);
raptor_message_handler handler;
} raptor_message_handler_closure;
/** /**
* raptor_statement_handler: * raptor_statement_handler:
* @user_data: user data * @user_data: user data
* @statement: statement to report * @statement: statement to report
* *
* Statement (triple) reporting handler function. * Statement (triple) reporting handler function.
*/ */
typedef void (*raptor_statement_handler)(void *user_data, const raptor_stat ement *statement); typedef void (*raptor_statement_handler)(void *user_data, raptor_statement *statement);
/** /**
* raptor_graph_handler: * raptor_graph_mark_flags:
* @RAPTOR_GRAPH_MARK_START: mark is start of graph (otherwise is end)
* @RAPTOR_GRAPH_MARK_DECLARED: mark was declared in syntax rather than imp
lict
*
* Graph mark handler bitmask flags
*/
typedef enum {
RAPTOR_GRAPH_MARK_START = 1,
RAPTOR_GRAPH_MARK_DECLARED = 2
} raptor_graph_mark_flags;
/**
* raptor_graph_mark_handler:
* @user_data: user data * @user_data: user data
* @graph: graph to report, 0 for the default graph * @graph: graph to report, NULL for the default graph
* @flags: bitmask of #raptor_graph_mark_flags flags
* *
* Named graph reporting handler function. Due to historic reasons the name * Graph start/end mark handler function.
d graph *
* API is separated from the statement handler. A graph is reported after a * Records start and end of graphs happening in a stream of generated
ll its * #raptor_statement via the statement handler. The callback starts a
* statements. * 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.
*/ */
typedef void (*raptor_graph_handler)(void *user_data, raptor_uri *graph); typedef void (*raptor_graph_mark_handler)(void *user_data, raptor_uri *grap h, int flags);
/** /**
* raptor_generate_id_handler: * raptor_generate_bnodeid_handler:
* @user_data: user data * @user_data: user data
* @type: type of ID to create
* @user_bnodeid: a user-specified ID or NULL if none available. * @user_bnodeid: a user-specified ID or NULL if none available.
* *
* Generate an identifier handler function. * Generate a blank node identifier handler function.
* *
* Return value: new ID to use * Return value: new blank node ID to use
*/ */
typedef unsigned char* (*raptor_generate_id_handler)(void *user_data, rapto r_genid_type type, unsigned char* user_bnodeid); typedef unsigned char* (*raptor_generate_bnodeid_handler)(void *user_data, unsigned char* user_bnodeid);
/** /**
* raptor_namespace_handler: * raptor_namespace_handler:
* @user_data: user data * @user_data: user data
* @nspace: #raptor_namespace declared * @nspace: #raptor_namespace declared
* *
* XML Namespace declaration reporting handler set by * XML Namespace declaration reporting handler set by
* raptor_set_namespace_handler(). * raptor_parser_set_namespace_handler().
*/ */
typedef void (*raptor_namespace_handler)(void* user_data, raptor_namespace *nspace); typedef void (*raptor_namespace_handler)(void* user_data, raptor_namespace *nspace);
/** /**
* raptor_www_write_bytes_handler: * raptor_www_write_bytes_handler:
* @www: WWW object * @www: WWW object
* @userdata: user data * @userdata: user data
* @ptr: data pointer * @ptr: data pointer
* @size: size of individual item * @size: size of individual item
* @nmemb: number of items * @nmemb: number of items
skipping to change at line 822 skipping to change at line 728
* @user_data: user data * @user_data: user data
* @uri: #raptor_uri URI to check * @uri: #raptor_uri URI to check
* *
* Callback function for #raptor_www_set_uri_filter * Callback function for #raptor_www_set_uri_filter
* *
* Return value: non-0 to filter the URI * Return value: non-0 to filter the URI
*/ */
typedef int (*raptor_uri_filter_func)(void *user_data, raptor_uri* uri); typedef int (*raptor_uri_filter_func)(void *user_data, raptor_uri* uri);
/** /**
* raptor_libxml_flags: * raptor_world_flag:
* @RAPTOR_LIBXML_FLAGS_GENERIC_ERROR_SAVE: if set - save/restore the libxm * @RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE: if set (non-0 value) - sav
l generic error handler when parsing (default unset) e/restore the libxml generic error handler when raptor library initializes
* @RAPTOR_LIBXML_FLAGS_STRUCTURED_ERROR_SAVE: if set - save/restore the li (default set)
bxml structured error handler when parsing (default unset) * @RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE: if set (non-0 value) -
save/restore the libxml structured error handler when raptor library termin
ates (default set)
* @RAPTOR_WORLD_FLAG_URI_INTERNING: if set (non-0 value) - each URI is sav
ed interned in-memory and reused (default set)
* @RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH: if set (non-0 value) the raptor
will neither initialise or terminate the lower level WWW library. Usually
in raptor initialising either curl_global_init (for libcurl) are called an
d in raptor cleanup, curl_global_cleanup is called. This flag allows the
application finer control over these libraries such as setting other global
options or potentially calling and terminating raptor several times. It d
oes mean that applications which use this call must do their own extra work
in order to allocate and free all resources to the system.
* *
* libxml library flags * Raptor world flags
* *
* These are used by raptor_world_set_libxml_flags() and * These are used by raptor_world_set_flags() to control raptor-wide
* raptor_set_libxml_flags() to control common libxml features. * options across classes. These must be set before
* raptor_world_open() is called explicitly or implicitly (by
* creating a raptor object). There is no enumeration function for
* these flags because they are not user options and must be set
* before the library is initialised. For similar reasons, there is
* no get function.
* *
* If any handler saving/restoring is enabled, any existing handler * If any libxml handler saving/restoring is enabled, any existing
* and context is saved before parsing and restored afterwards. * handler and context is saved before parsing and restored
* Otherwise, no saving/restoring is performed. * afterwards. Otherwise, no saving/restoring is performed.
* *
*/ */
typedef enum { typedef enum {
RAPTOR_LIBXML_FLAGS_GENERIC_ERROR_SAVE = 1, RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE = 1,
RAPTOR_LIBXML_FLAGS_STRUCTURED_ERROR_SAVE = 2 RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE = 2,
} raptor_libxml_flags; RAPTOR_WORLD_FLAG_URI_INTERNING = 3,
RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH = 4
} raptor_world_flag;
/**
* raptor_data_compare_handler:
* @data1: first data object
* @data2: second data object
*
* Function to compare two data objects - signature like strcmp() and funct
ion pssed to qsort()
*
* Designed to be passed into generic data structure constructors
* like raptor_new_avltree().
*
* Return value: compare value <0 if @data1 is before @data2, =0 if equal,
>0 if @data1 is after @data2
*/
typedef int (*raptor_data_compare_handler)(const void* data1, const void* d
ata2);
/**
* raptor_data_malloc_handler:
* @size: data size
*
* Typedef for a function to allocate memory - signature like malloc()
*
* Designed to be passed into constructors
* like raptor_www_fetch_to_string
*
* Return value: pointer to newly allocated memory or NULL on failure
*/
typedef void* (*raptor_data_malloc_handler)(size_t size);
/**
* raptor_data_free_handler:
* @data: data object or NULL
*
* Typedef for function to free a data object - signature like free()
*
* Designed to be passed into generic data structure constructors
* like raptor_new_avltree(). If @data is NULL, nothing should be done.
*/
typedef void (*raptor_data_free_handler)(void* data);
/**
* raptor_data_context_free_handler:
* @context: context data for the free function
* @object: object to free
*
* Handler function for freeing a sequence item with a contextual pointer.
*
* Set by raptor_new_sequence_with_context().
*/
typedef void (*raptor_data_context_free_handler)(void* context, void* objec
t);
/**
* raptor_data_print_handler:
* @object: object to print
* @fh: FILE* to print to
*
* Handler function for printing an object to a stream.
*
* Set by raptor_new_sequence()
*
* Return value: non-0 on failure
*/
typedef int (*raptor_data_print_handler)(void *object, FILE *fh);
/**
* raptor_data_context_print_handler:
* @context: context data for the print function
* @object: object to print
* @fh: FILE* to print to
*
* Function function for printing an object with data context to a stream.
*
* Set by raptor_new_sequence_with_context()
*
* Return value: non-0 on failure
*/
typedef int (*raptor_data_context_print_handler)(void *context, void *objec
t, FILE *fh);
/* Public functions */ /* Public functions */
RAPTOR_API RAPTOR_API
raptor_world* raptor_new_world(void); raptor_world* raptor_new_world(void);
RAPTOR_API RAPTOR_API
int raptor_world_open(raptor_world* world); int raptor_world_open(raptor_world* world);
RAPTOR_API RAPTOR_API
void raptor_free_world(raptor_world* world); void raptor_free_world(raptor_world* world);
RAPTOR_API RAPTOR_API
void raptor_world_set_libxslt_security_preferences(raptor_world *world, voi d *security_preferences); int raptor_world_set_libxslt_security_preferences(raptor_world *world, void *security_preferences);
RAPTOR_API RAPTOR_API
void raptor_world_set_libxml_flags(raptor_world *world, int flags); int raptor_world_set_flag(raptor_world *world, raptor_world_flag flag, int
value);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
void raptor_init(void);
RAPTOR_API RAPTOR_V1
void raptor_finish(void);
RAPTOR_API RAPTOR_V1
void raptor_set_libxslt_security_preferences(void *security_preferences);
void raptor_set_libxml_flags(int flags);
#endif
/* Get parser names */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
int raptor_parsers_enumerate(const unsigned int counter, const char **name,
const char **label);
RAPTOR_API RAPTOR_V1
int raptor_syntaxes_enumerate(const unsigned int counter, const char **name
, const char **label, const char **mime_type, const unsigned char **uri_str
ing);
RAPTOR_API RAPTOR_V1
int raptor_syntax_name_check(const char *name);
RAPTOR_API RAPTOR_V1
const char* raptor_guess_parser_name(raptor_uri *uri, const char *mime_type
, const unsigned char *buffer, size_t len, const unsigned char *identifier)
;
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
int raptor_parsers_enumerate_v2(raptor_world* world, const unsigned int cou nter, const char **name, const char **label); int raptor_world_set_log_handler(raptor_world *world, void *user_data, rapt or_log_handler handler);
RAPTOR_API RAPTOR_API
int raptor_syntaxes_enumerate_v2(raptor_world* world, const unsigned int co unter, const char **name, const char **label, const char **mime_type, const unsigned char **uri_string); void raptor_world_set_generate_bnodeid_handler(raptor_world* world, void *u ser_data, raptor_generate_bnodeid_handler handler);
RAPTOR_API RAPTOR_API
int raptor_syntax_name_check_v2(raptor_world* world, const char *name); unsigned char* raptor_world_generate_bnodeid(raptor_world *world);
RAPTOR_API RAPTOR_API
const char* raptor_guess_parser_name_v2(raptor_world* world, raptor_uri *ur void raptor_world_set_generate_bnodeid_parameters(raptor_world* world, char
i, const char *mime_type, const unsigned char *buffer, size_t len, const un *prefix, int base);
signed char *identifier);
#endif
/* Create */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_parser* raptor_new_parser(const char *name);
RAPTOR_API RAPTOR_V1
raptor_parser* raptor_new_parser_for_content(raptor_uri *uri, const char *m
ime_type, const unsigned char *buffer, size_t len, const unsigned char *ide
ntifier);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_parser* raptor_new_parser_v2(raptor_world* world, const char *name); const char* raptor_log_level_get_label(raptor_log_level level);
RAPTOR_API RAPTOR_API
raptor_parser* raptor_new_parser_for_content_v2(raptor_world* world, raptor const char* raptor_domain_get_label(raptor_domain domain);
_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len,
const unsigned char *identifier);
#endif
/* Parser names */
RAPTOR_API RAPTOR_API
int raptor_start_parse(raptor_parser *rdf_parser, raptor_uri *uri); const raptor_syntax_description* raptor_world_get_parser_description(raptor
_world* world, unsigned int counter);
/* Destroy */
RAPTOR_API RAPTOR_API
void raptor_free_parser(raptor_parser* parser); int raptor_world_is_parser_name(raptor_world* world, const char *name);
/* Handlers */
RAPTOR_API RAPTOR_API
void raptor_set_fatal_error_handler(raptor_parser* parser, void *user_data, const char* raptor_world_guess_parser_name(raptor_world* world, raptor_uri
raptor_message_handler handler); *uri, const char *mime_type, const unsigned char *buffer, size_t len, const
unsigned char *identifier);
RAPTOR_API RAPTOR_API
void raptor_set_error_handler(raptor_parser* parser, void *user_data, rapto r_message_handler handler); const raptor_syntax_description* raptor_world_get_serializer_description(ra ptor_world* world, unsigned int counter);
RAPTOR_API RAPTOR_API
void raptor_set_warning_handler(raptor_parser* parser, void *user_data, rap tor_message_handler handler); int raptor_world_is_serializer_name(raptor_world* world, const char *name);
RAPTOR_API RAPTOR_API
void raptor_set_statement_handler(raptor_parser* parser, void *user_data, r raptor_option raptor_world_get_option_from_uri(raptor_world* world, raptor_
aptor_statement_handler handler); uri *uri);
/* Term Class */
RAPTOR_API RAPTOR_API
void raptor_set_graph_handler(raptor_parser* parser, void *user_data, rapto r_graph_handler handler); raptor_term* raptor_new_term_from_uri(raptor_world* world, raptor_uri* uri) ;
RAPTOR_API RAPTOR_API
void raptor_set_generate_id_handler(raptor_parser* parser, void *user_data, raptor_generate_id_handler handler); raptor_term* raptor_new_term_from_literal(raptor_world* world, const unsign ed char* literal, raptor_uri* datatype, const unsigned char* language);
RAPTOR_API RAPTOR_API
void raptor_set_namespace_handler(raptor_parser* parser, void *user_data, r aptor_namespace_handler handler); raptor_term* raptor_new_term_from_counted_literal(raptor_world* world, cons t unsigned char* literal, size_t literal_len, raptor_uri* datatype, const u nsigned char* language, unsigned char language_len);
RAPTOR_API RAPTOR_API
void raptor_parser_set_uri_filter(raptor_parser* parser, raptor_uri_filter_ raptor_term* raptor_new_term_from_blank(raptor_world* world, const unsigned
func filter, void* user_data); char* blank);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
void raptor_print_statement(const raptor_statement * statement, FILE *strea
m);
RAPTOR_API RAPTOR_V1
void raptor_print_statement_as_ntriples(const raptor_statement * statement,
FILE *stream);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
void raptor_print_statement_v2(const raptor_statement_v2 * statement, FILE *stream); raptor_term* raptor_new_term_from_counted_blank(raptor_world* world, const unsigned char* blank, size_t length);
RAPTOR_API RAPTOR_API
void raptor_print_statement_as_ntriples_v2(const raptor_statement_v2 * stat raptor_term* raptor_term_copy(raptor_term* term);
ement, FILE *stream);
#endif
#if !defined(RAPTOR_DISABLE_DEPRECATED) && !defined(RAPTOR_DISABLE_V1)
RAPTOR_API RAPTOR_DEPRECATED
void raptor_print_statement_detailed(const raptor_statement * statement, in
t detailed, FILE *stream);
#endif
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
unsigned char* raptor_statement_part_as_counted_string(const void *term, ra
ptor_identifier_type type, raptor_uri* literal_datatype, const unsigned cha
r *literal_language, size_t* len_p);
RAPTOR_API RAPTOR_V1
unsigned char* raptor_statement_part_as_string(const void *term, raptor_ide
ntifier_type type, raptor_uri* literal_datatype, const unsigned char *liter
al_language);
RAPTOR_API RAPTOR_V1
int raptor_statement_compare(const raptor_statement *s1, const raptor_state
ment *s2);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
unsigned char* raptor_statement_part_as_counted_string_v2(raptor_world* wor ld, const void *term, raptor_identifier_type type, raptor_uri* literal_data type, const unsigned char *literal_language, size_t* len_p); int raptor_term_compare(const raptor_term *t1, const raptor_term *t2);
RAPTOR_API RAPTOR_API
unsigned char* raptor_statement_part_as_string_v2(raptor_world* world, cons t void *term, raptor_identifier_type type, raptor_uri* literal_datatype, co nst unsigned char *literal_language); int raptor_term_equals(raptor_term* t1, raptor_term* t2);
RAPTOR_API RAPTOR_API
int raptor_statement_compare_v2(const raptor_statement_v2 *s1, const raptor void raptor_free_term(raptor_term *term);
_statement_v2 *s2);
#endif
RAPTOR_API RAPTOR_API
raptor_locator* raptor_get_locator(raptor_parser* rdf_parser); unsigned char* raptor_term_as_counted_string(raptor_term *term, size_t* len
_p);
RAPTOR_API RAPTOR_API
void raptor_set_default_generate_id_parameters(raptor_parser* rdf_parser, c unsigned char* raptor_term_as_string(raptor_term *term);
har *prefix, int base); RAPTOR_API
int raptor_term_ntriples_write(const raptor_term *term, raptor_iostream* io
str);
/* Parsing functions */ /* Statement Class */
RAPTOR_API RAPTOR_API
int raptor_parse_chunk(raptor_parser* rdf_parser, const unsigned char *buff er, size_t len, int is_end); void raptor_statement_init(raptor_statement *statement, raptor_world *world );
RAPTOR_API RAPTOR_API
int raptor_parse_file_stream(raptor_parser* rdf_parser, FILE *stream, const char *filename, raptor_uri *base_uri); void raptor_statement_clear(raptor_statement *statement);
RAPTOR_API RAPTOR_API
int raptor_parse_file(raptor_parser* rdf_parser, raptor_uri *uri, raptor_ur i *base_uri); raptor_statement* raptor_new_statement(raptor_world *world);
RAPTOR_API RAPTOR_API
int raptor_parse_uri(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri); raptor_statement* raptor_new_statement_from_nodes(raptor_world* world, rapt or_term *subject, raptor_term *predicate, raptor_term *object, raptor_term *graph);
RAPTOR_API RAPTOR_API
int raptor_parse_uri_with_connection(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri, void *connection); raptor_statement* raptor_statement_copy(raptor_statement *statement);
RAPTOR_API RAPTOR_API
void raptor_parse_abort(raptor_parser* rdf_parser); void raptor_free_statement(raptor_statement *statement);
/* Utility functions */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
void raptor_print_locator(FILE *stream, raptor_locator* locator);
RAPTOR_API RAPTOR_V1
int raptor_format_locator(char *buffer, size_t length, raptor_locator* loca
tor);
RAPTOR_API RAPTOR_V1
const char * raptor_locator_uri(raptor_locator *locator);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
void raptor_print_locator_v2(raptor_world* world, FILE *stream, raptor_loca tor* locator); int raptor_statement_print(const raptor_statement * statement, FILE *stream );
RAPTOR_API RAPTOR_API
int raptor_format_locator_v2(raptor_world* world, char *buffer, size_t leng int raptor_statement_print_as_ntriples(const raptor_statement * statement,
th, raptor_locator* locator); FILE *stream);
#endif
RAPTOR_API RAPTOR_API
int raptor_locator_line(raptor_locator *locator); int raptor_statement_compare(const raptor_statement *s1, const raptor_state ment *s2);
RAPTOR_API RAPTOR_API
int raptor_locator_column(raptor_locator *locator); int raptor_statement_equals(const raptor_statement* s1, const raptor_statem
ent* s2);
/* Parser Class */
RAPTOR_API RAPTOR_API
int raptor_locator_byte(raptor_locator *locator); raptor_parser* raptor_new_parser(raptor_world* world, const char *name);
RAPTOR_API RAPTOR_API
const char * raptor_locator_file(raptor_locator *locator); raptor_parser* raptor_new_parser_for_content(raptor_world* world, raptor_ur
#ifdef RAPTOR_V2_AVAILABLE i *uri, const char *mime_type, const unsigned char *buffer, size_t len, con
st unsigned char *identifier);
RAPTOR_API RAPTOR_API
const char * raptor_locator_uri_v2(raptor_world* world, raptor_locator *loc void raptor_free_parser(raptor_parser* parser);
ator);
#endif /* methods */
/* Handlers */
RAPTOR_API RAPTOR_API
const char* raptor_get_name(raptor_parser *rdf_parser); void raptor_parser_set_statement_handler(raptor_parser* parser, void *user_ data, raptor_statement_handler handler);
RAPTOR_API RAPTOR_API
const char* raptor_get_label(raptor_parser *rdf_parser); void raptor_parser_set_graph_mark_handler(raptor_parser* parser, void *user _data, raptor_graph_mark_handler handler);
RAPTOR_API RAPTOR_API
const char* raptor_get_mime_type(raptor_parser *rdf_parser); void raptor_parser_set_namespace_handler(raptor_parser* parser, void *user_ data, raptor_namespace_handler handler);
RAPTOR_API RAPTOR_API
int raptor_get_need_base_uri(raptor_parser *rdf_parser); void raptor_parser_set_uri_filter(raptor_parser* parser, raptor_uri_filter_
func filter, void* user_data);
RAPTOR_API
raptor_locator* raptor_parser_get_locator(raptor_parser* rdf_parser);
#ifndef RAPTOR_DISABLE_V1 /* Parsing functions */
RAPTOR_API RAPTOR_V1
int raptor_features_enumerate(const raptor_feature feature, const char **na
me, raptor_uri **uri, const char **label);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
int raptor_features_enumerate_v2(raptor_world* world, const raptor_feature int raptor_parser_parse_start(raptor_parser *rdf_parser, raptor_uri *uri);
feature, const char **name, raptor_uri **uri, const char **label);
#endif
RAPTOR_API RAPTOR_API
int raptor_set_feature(raptor_parser *parser, raptor_feature feature, int v alue); int raptor_parser_parse_chunk(raptor_parser* rdf_parser, const unsigned cha r *buffer, size_t len, int is_end);
RAPTOR_API RAPTOR_API
int raptor_parser_set_feature_string(raptor_parser *parser, raptor_feature feature, const unsigned char *value); int raptor_parser_parse_file_stream(raptor_parser* rdf_parser, FILE *stream , const char *filename, raptor_uri *base_uri);
RAPTOR_API RAPTOR_API
int raptor_get_feature(raptor_parser *parser, raptor_feature feature); int raptor_parser_parse_file(raptor_parser* rdf_parser, raptor_uri *uri, ra ptor_uri *base_uri);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_parser_get_feature_string(raptor_parser *parser , raptor_feature feature); int raptor_parser_parse_uri(raptor_parser* rdf_parser, raptor_uri *uri, rap tor_uri *base_uri);
RAPTOR_API RAPTOR_API
unsigned int raptor_get_feature_count(void); int raptor_parser_parse_uri_with_connection(raptor_parser* rdf_parser, rapt or_uri *uri, raptor_uri *base_uri, void *connection);
RAPTOR_API RAPTOR_API
void raptor_set_parser_strict(raptor_parser* rdf_parser, int is_strict); int raptor_parser_parse_iostream(raptor_parser* rdf_parser, raptor_iostream *iostr, raptor_uri *base_uri);
RAPTOR_API RAPTOR_API
const char* raptor_parser_get_accept_header(raptor_parser* rdf_parser); void raptor_parser_parse_abort(raptor_parser* rdf_parser);
RAPTOR_API
const char* raptor_parser_get_name(raptor_parser *rdf_parser);
RAPTOR_API
const raptor_syntax_description* raptor_parser_get_description(raptor_parse
r *rdf_parser);
unsigned char* raptor_parser_generate_id(raptor_parser *rdf_parser, raptor_ /* parser option methods */
genid_type type); RAPTOR_API
int raptor_parser_set_option(raptor_parser *parser, raptor_option option, c
onst char* string, int integer);
RAPTOR_API
int raptor_parser_get_option(raptor_parser *parser, raptor_option option, c
har** string_p, int* integer_p);
/* parser utility methods */
RAPTOR_API
const char* raptor_parser_get_accept_header(raptor_parser* rdf_parser);
RAPTOR_API RAPTOR_API
raptor_world* raptor_parser_get_world(raptor_parser* rdf_parser); raptor_world* raptor_parser_get_world(raptor_parser* rdf_parser);
RAPTOR_API
raptor_uri* raptor_parser_get_graph(raptor_parser* rdf_parser);
/* Get serializer names */ /* Locator Class */
#ifndef RAPTOR_DISABLE_V1 /* methods */
RAPTOR_API RAPTOR_V1
int raptor_serializers_enumerate(const unsigned int counter, const char **n
ame, const char **label, const char **mime_type, const unsigned char **uri_
string);
RAPTOR_API RAPTOR_V1
int raptor_serializer_syntax_name_check(const char *name);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
int raptor_serializers_enumerate_v2(raptor_world* world, const unsigned int counter, const char **name, const char **label, const char **mime_type, co nst unsigned char **uri_string); int raptor_locator_print(raptor_locator* locator, FILE *stream);
RAPTOR_API RAPTOR_API
int raptor_serializer_syntax_name_check_v2(raptor_world* world, const char int raptor_locator_format(char *buffer, size_t length, raptor_locator* loca
*name); tor);
#endif RAPTOR_API
int raptor_locator_line(raptor_locator *locator);
RAPTOR_API
int raptor_locator_column(raptor_locator *locator);
RAPTOR_API
int raptor_locator_byte(raptor_locator *locator);
RAPTOR_API
const char* raptor_locator_file(raptor_locator *locator);
RAPTOR_API
const char* raptor_locator_uri(raptor_locator *locator);
/* Serializing */ /* Serializer Class */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_serializer* raptor_new_serializer(const char *name);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_serializer* raptor_new_serializer_v2(raptor_world* world, const char raptor_serializer* raptor_new_serializer(raptor_world* world, const char *n
*name); ame);
#endif
RAPTOR_API RAPTOR_API
void raptor_free_serializer(raptor_serializer* rdf_serializer); void raptor_free_serializer(raptor_serializer* rdf_serializer);
/* methods */
RAPTOR_API RAPTOR_API
int raptor_serialize_start(raptor_serializer *rdf_serializer, raptor_uri *u int raptor_serializer_start_to_iostream(raptor_serializer *rdf_serializer,
ri, raptor_iostream *iostream); raptor_uri *uri, raptor_iostream *iostream);
RAPTOR_API
int raptor_serialize_start_to_iostream(raptor_serializer *rdf_serializer, r
aptor_uri *uri, raptor_iostream *iostream);
RAPTOR_API RAPTOR_API
int raptor_serialize_start_to_filename(raptor_serializer *rdf_serializer, c onst char *filename); int raptor_serializer_start_to_filename(raptor_serializer *rdf_serializer, const char *filename);
RAPTOR_API RAPTOR_API
int raptor_serialize_start_to_string(raptor_serializer *rdf_serializer, rap tor_uri *uri, void **string_p, size_t *length_p); int raptor_serializer_start_to_string(raptor_serializer *rdf_serializer, ra ptor_uri *uri, void **string_p, size_t *length_p);
RAPTOR_API RAPTOR_API
int raptor_serialize_start_to_file_handle(raptor_serializer *rdf_serializer , raptor_uri *uri, FILE *fh); int raptor_serializer_start_to_file_handle(raptor_serializer *rdf_serialize r, raptor_uri *uri, FILE *fh);
RAPTOR_API RAPTOR_API
int raptor_serialize_set_namespace(raptor_serializer* rdf_serializer, rapto r_uri *uri, const unsigned char *prefix); int raptor_serializer_set_namespace(raptor_serializer* rdf_serializer, rapt or_uri *uri, const unsigned char *prefix);
RAPTOR_API RAPTOR_API
int raptor_serialize_set_namespace_from_namespace(raptor_serializer* rdf_se rializer, raptor_namespace *nspace); int raptor_serializer_set_namespace_from_namespace(raptor_serializer* rdf_s erializer, raptor_namespace *nspace);
RAPTOR_API RAPTOR_API
int raptor_serialize_statement(raptor_serializer* rdf_serializer, const rap tor_statement *statement); int raptor_serializer_serialize_statement(raptor_serializer* rdf_serializer , raptor_statement *statement);
RAPTOR_API RAPTOR_API
int raptor_serialize_end(raptor_serializer *rdf_serializer); int raptor_serializer_serialize_end(raptor_serializer *rdf_serializer);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_serializer_get_iostream(raptor_serializer *serializ er); raptor_iostream* raptor_serializer_get_iostream(raptor_serializer *serializ er);
RAPTOR_API RAPTOR_API
void raptor_serializer_set_error_handler(raptor_serializer* serializer, voi
d *user_data, raptor_message_handler handler);
RAPTOR_API
void raptor_serializer_set_warning_handler(raptor_serializer* serializer, v
oid *user_data, raptor_message_handler handler);
RAPTOR_API
raptor_locator* raptor_serializer_get_locator(raptor_serializer *rdf_serial izer); raptor_locator* raptor_serializer_get_locator(raptor_serializer *rdf_serial izer);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
int raptor_serializer_features_enumerate(const raptor_feature feature, cons
t char **name, raptor_uri **uri, const char **label);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
int raptor_serializer_features_enumerate_v2(raptor_world* world, const rapt int raptor_serializer_flush(raptor_serializer *rdf_serializer);
or_feature feature, const char **name, raptor_uri **uri, const char **labe
l);
#endif
RAPTOR_API
int raptor_serializer_set_feature(raptor_serializer *serializer, raptor_fea
ture feature, int value);
RAPTOR_API RAPTOR_API
int raptor_serializer_set_feature_string(raptor_serializer *serializer, rap const raptor_syntax_description* raptor_serializer_get_description(raptor_s
tor_feature feature, const unsigned char *value); erializer *rdf_serializer);
/* serializer option methods */
RAPTOR_API RAPTOR_API
int raptor_serializer_get_feature(raptor_serializer *serializer, raptor_fea ture feature); int raptor_serializer_set_option(raptor_serializer *serializer, raptor_opti on option, const char* string, int integer);
RAPTOR_API RAPTOR_API
const unsigned char *raptor_serializer_get_feature_string(raptor_serializer *serializer, raptor_feature feature); int raptor_serializer_get_option(raptor_serializer *serializer, raptor_opti on option, char** string_p, int* integer_p);
/* utility methods */
RAPTOR_API RAPTOR_API
raptor_world* raptor_serializer_get_world(raptor_serializer* rdf_serializer ); raptor_world* raptor_serializer_get_world(raptor_serializer* rdf_serializer );
/* memory functions */ /* memory functions */
RAPTOR_API RAPTOR_API
void raptor_free_memory(void *ptr); void raptor_free_memory(void *ptr);
RAPTOR_API RAPTOR_API
void* raptor_alloc_memory(size_t size); void* raptor_alloc_memory(size_t size);
RAPTOR_API RAPTOR_API
void* raptor_calloc_memory(size_t nmemb, size_t size); void* raptor_calloc_memory(size_t nmemb, size_t size);
/* URI functions */ /* URI Class */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri(const unsigned char *uri_string);
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri_from_uri_local_name(raptor_uri *uri, const unsig
ned char *local_name);
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri_relative_to_base(raptor_uri *base_uri, const uns
igned char *uri_string);
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri_from_id(raptor_uri *base_uri, const unsigned cha
r *id);
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri_for_rdf_concept(const char *name);
RAPTOR_API RAPTOR_V1
void raptor_free_uri(raptor_uri *uri);
RAPTOR_API RAPTOR_V1
int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2);
RAPTOR_API RAPTOR_V1
int raptor_uri_compare(raptor_uri* uri1, raptor_uri* uri2);
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_uri_copy(raptor_uri *uri);
RAPTOR_API RAPTOR_V1
unsigned char* raptor_uri_as_string(raptor_uri *uri);
RAPTOR_API RAPTOR_V1
unsigned char* raptor_uri_as_counted_string(raptor_uri *uri, size_t* len_p)
;
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
raptor_uri* raptor_new_uri_v2(raptor_world* world, const unsigned char *uri
_string);
RAPTOR_API
raptor_uri* raptor_new_uri_from_uri_local_name_v2(raptor_world* world, rapt
or_uri *uri, const unsigned char *local_name);
RAPTOR_API
raptor_uri* raptor_new_uri_relative_to_base_v2(raptor_world* world, raptor_
uri *base_uri, const unsigned char *uri_string);
RAPTOR_API
raptor_uri* raptor_new_uri_from_id_v2(raptor_world* world, raptor_uri *base
_uri, const unsigned char *id);
RAPTOR_API RAPTOR_API
raptor_uri* raptor_new_uri_for_rdf_concept_v2(raptor_world* world, const ch ar *name); raptor_uri* raptor_new_uri_from_counted_string(raptor_world* world, const u nsigned char *uri_string, size_t length);
RAPTOR_API RAPTOR_API
void raptor_free_uri_v2(raptor_world* world, raptor_uri *uri); raptor_uri* raptor_new_uri(raptor_world* world, const unsigned char *uri_st ring);
RAPTOR_API RAPTOR_API
int raptor_uri_equals_v2(raptor_world* world, raptor_uri* uri1, raptor_uri* uri2); raptor_uri* raptor_new_uri_from_uri_local_name(raptor_world* world, raptor_ uri *uri, const unsigned char *local_name);
RAPTOR_API RAPTOR_API
int raptor_uri_compare_v2(raptor_world* world, raptor_uri* uri1, raptor_uri * uri2); raptor_uri* raptor_new_uri_relative_to_base(raptor_world* world, raptor_uri *base_uri, const unsigned char *uri_string);
RAPTOR_API RAPTOR_API
raptor_uri* raptor_uri_copy_v2(raptor_world* world, raptor_uri *uri); raptor_uri* raptor_new_uri_from_id(raptor_world* world, raptor_uri *base_ur i, const unsigned char *id);
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_as_string_v2(raptor_world* world, raptor_uri *uri ); raptor_uri* raptor_new_uri_for_rdf_concept(raptor_world* world, const unsig ned char *name);
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_as_counted_string_v2(raptor_world* world, raptor_
uri *uri, size_t* len_p);
#endif
/* Make an xml:base-compatible URI from an existing one */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri); raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_uri* raptor_new_uri_for_xmlbase_v2(raptor_world* world, raptor_uri*
old_uri);
#endif
/* Make a URI suitable for retrieval (no fragment, has path) from an existi
ng one */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_uri* raptor_new_uri_for_retrieval(raptor_uri* old_uri); raptor_uri* raptor_new_uri_for_retrieval(raptor_uri* old_uri);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
raptor_uri* raptor_new_uri_for_retrieval_v2(raptor_world* world, raptor_uri
* old_uri);
#endif
/* Identifier functions */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_identifier* raptor_new_identifier(raptor_identifier_type type, rapto
r_uri *uri, raptor_uri_source uri_source, const unsigned char *id, const un
signed char *literal, raptor_uri *literal_datatype, const unsigned char *li
teral_language);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
raptor_identifier* raptor_new_identifier_v2(raptor_world* world, raptor_ide
ntifier_type type, raptor_uri *uri, raptor_uri_source uri_source, const uns
igned char *id, const unsigned char *literal, raptor_uri *literal_datatype,
const unsigned char *literal_language);
#endif
RAPTOR_API
int raptor_copy_identifier(raptor_identifier *dest, raptor_identifier *src)
;
RAPTOR_API RAPTOR_API
void raptor_free_identifier(raptor_identifier *identifier); void raptor_free_uri(raptor_uri *uri);
/* Utility functions */ /* methods */
RAPTOR_API RAPTOR_API
int raptor_print_ntriples_string(FILE *stream, const unsigned char *string, int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2);
const char delim);
#ifndef RAPTOR_DISABLE_DEPRECATED
RAPTOR_API RAPTOR_DEPRECATED
unsigned char* raptor_ntriples_string_as_utf8_string(raptor_parser* rdf_par
ser, const unsigned char *src, int len, size_t *dest_lenp);
#endif
#ifndef RAPTOR_DISABLE_DEPRECATED
RAPTOR_API RAPTOR_DEPRECATED
const char* raptor_ntriples_term_as_string(raptor_ntriples_term_type term);
#endif
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string_ntriples(raptor_iostream *iostr, const uns igned char *string, size_t len, const char delim); int raptor_uri_compare(raptor_uri* uri1, raptor_uri* uri2);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string_python(raptor_iostream *iostr, const unsig raptor_uri* raptor_uri_copy(raptor_uri *uri);
ned char *string, size_t len, const char delim, int flags);
#ifndef RAPTOR_DISABLE_DEPRECATED
RAPTOR_API RAPTOR_DEPRECATED
void raptor_iostream_write_string_turtle(raptor_iostream *iostr, const unsi
gned char *string, size_t len);
#endif
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
void raptor_iostream_write_statement_ntriples(raptor_iostream* iostr, const
raptor_statement *statement);
RAPTOR_API RAPTOR_API
#endif unsigned char* raptor_uri_as_string(raptor_uri *uri);
#ifdef RAPTOR_V2_AVAILABLE
void raptor_iostream_write_statement_ntriples_v2(raptor_world* world, rapto
r_iostream* iostr, const raptor_statement *statement);
#endif
RAPTOR_API RAPTOR_API
int raptor_xml_any_escape_string(const unsigned char *string, size_t len, u nsigned char *buffer, size_t length, char quote, int xml_version, raptor_si mple_message_handler error_handler, void *error_data); unsigned char* raptor_uri_as_counted_string(raptor_uri *uri, size_t* len_p) ;
RAPTOR_API RAPTOR_API
int raptor_iostream_write_xml_any_escaped_string(raptor_iostream* iostr, co nst unsigned char *string, size_t len, char quote, int xml_version, raptor_ simple_message_handler error_handler, void *error_data); unsigned char* raptor_uri_to_relative_counted_uri_string(raptor_uri *base_u ri, raptor_uri *reference_uri, size_t *length_p);
RAPTOR_API RAPTOR_API
int raptor_xml_escape_string(const unsigned char *string, size_t len, unsig ned char *buffer, size_t length, char quote, raptor_simple_message_handler error_handler, void *error_data); unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri, rap tor_uri *reference_uri);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_xml_escaped_string(raptor_iostream* iostr, const int raptor_uri_print(const raptor_uri* uri, FILE *stream);
unsigned char *string, size_t len, char quote, raptor_simple_message_handle
r error_handler, void *error_data);
RAPTOR_API RAPTOR_API
char* raptor_vsnprintf(const char *message, va_list arguments) RAPTOR_PRINT unsigned char* raptor_uri_to_counted_string(raptor_uri *uri, size_t *len_p)
F_FORMAT(1, 0); ;
RAPTOR_API RAPTOR_API
int raptor_xml_name_check(const unsigned char *string, size_t length, int x unsigned char* raptor_uri_to_string(raptor_uri *uri);
ml_version);
/* raptor_rfc2396.c */
RAPTOR_API RAPTOR_API
void raptor_uri_resolve_uri_reference(const unsigned char *base_uri, const unsigned char *reference_uri, unsigned char* buffer, size_t length); raptor_world* raptor_uri_get_world(raptor_uri *uri);
/* raptor_uri.c */ /* XML utility functions */
RAPTOR_API RAPTOR_API
unsigned char *raptor_uri_filename_to_uri_string(const char *filename); int raptor_xml_escape_string_any(raptor_world* world, const unsigned char * string, size_t len, unsigned char *buffer, size_t length, char quote, int x ml_version);
RAPTOR_API RAPTOR_API
char *raptor_uri_uri_string_to_filename(const unsigned char *uri_string); int raptor_xml_escape_string_any_write(const unsigned char *string, size_t len, char quote, int xml_version, raptor_iostream* iostr);
RAPTOR_API RAPTOR_API
char *raptor_uri_uri_string_to_filename_fragment(const unsigned char *uri_s int raptor_xml_escape_string(raptor_world *world, const unsigned char *stri
tring, unsigned char **fragment_p); ng, size_t len, unsigned char *buffer, size_t length, char quote);
#ifndef RAPTOR_DISABLE_DEPRECATED
RAPTOR_API RAPTOR_DEPRECATED
int raptor_uri_is_file_uri(const unsigned char* uri_string);
#endif
RAPTOR_API RAPTOR_API
int raptor_uri_uri_string_is_file_uri(const unsigned char* uri_string); int raptor_xml_escape_string_write(const unsigned char *string, size_t len,
#ifndef RAPTOR_DISABLE_V1 char quote, raptor_iostream* iostr);
RAPTOR_API RAPTOR_V1
unsigned char* raptor_uri_to_relative_counted_uri_string(raptor_uri *base_u
ri, raptor_uri *reference_uri, size_t *length_p);
RAPTOR_API RAPTOR_V1
unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri, rap
tor_uri *reference_uri);
RAPTOR_API RAPTOR_V1
void raptor_uri_print(const raptor_uri* uri, FILE *stream);
RAPTOR_API RAPTOR_V1
unsigned char* raptor_uri_to_counted_string(raptor_uri *uri, size_t *len_p)
;
RAPTOR_API RAPTOR_V1
unsigned char* raptor_uri_to_string(raptor_uri *uri);
RAPTOR_API RAPTOR_V1
void raptor_uri_set_handler(const raptor_uri_handler *handler, void *contex
t);
RAPTOR_API RAPTOR_V1
void raptor_uri_get_handler(const raptor_uri_handler **handler, void **cont
ext);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_relative_counted_uri_string_v2(raptor_world* w int raptor_xml_name_check(const unsigned char *string, size_t length, int x
orld, raptor_uri *base_uri, raptor_uri *reference_uri, size_t *length_p); ml_version);
/* portable vsnprintf utility function */
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_relative_uri_string_v2(raptor_world* world, ra ptor_uri *base_uri, raptor_uri *reference_uri); char* raptor_vsnprintf(const char *message, va_list arguments) RAPTOR_PRINT F_FORMAT(1, 0);
/* RFC2396 URI resolving functions */
RAPTOR_API RAPTOR_API
void raptor_uri_print_v2(raptor_world* world, const raptor_uri* uri, FILE * size_t raptor_uri_resolve_uri_reference(const unsigned char *base_uri, cons
stream); t unsigned char *reference_uri, unsigned char* buffer, size_t length);
/* URI String utility functions */
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_counted_string_v2(raptor_world* world, raptor_ uri *uri, size_t *len_p); unsigned char* raptor_uri_filename_to_uri_string(const char *filename);
RAPTOR_API RAPTOR_API
unsigned char* raptor_uri_to_string_v2(raptor_world* world, raptor_uri *uri char* raptor_uri_uri_string_to_filename(const unsigned char *uri_string);
);
RAPTOR_API RAPTOR_API
void raptor_uri_set_handler_v2(raptor_world* world, const raptor_uri_handle r *handler, void *context); char* raptor_uri_uri_string_to_filename_fragment(const unsigned char *uri_s tring, unsigned char **fragment_p);
RAPTOR_API RAPTOR_API
void raptor_uri_get_handler_v2(raptor_world* world, const raptor_uri_handle int raptor_uri_uri_string_is_file_uri(const unsigned char* uri_string);
r **handler, void **context);
#endif
/** /**
* RAPTOR_RDF_MS_URI: * RAPTOR_RDF_MS_URI:
* *
* RDF Namespace URI (rdf:). * RDF Namespace URI (rdf:).
* *
* Copy with raptor_uri_copy() to use. * Copy with raptor_uri_copy() to use.
*/ */
#define RAPTOR_RDF_MS_URI raptor_rdf_namespace_uri #define RAPTOR_RDF_MS_URI raptor_rdf_namespace_uri
skipping to change at line 1337 skipping to change at line 1158
/** /**
* RAPTOR_OWL_URI: * RAPTOR_OWL_URI:
* *
* OWL Namespace URI (owl:). * OWL Namespace URI (owl:).
* *
* Copy with raptor_uri_copy() to use. * Copy with raptor_uri_copy() to use.
*/ */
#define RAPTOR_OWL_URI raptor_owl_namespace_uri #define RAPTOR_OWL_URI raptor_owl_namespace_uri
/* raptor_www */ /* raptor_www */
#ifndef RAPOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
void raptor_www_init(void);
RAPTOR_API RAPTOR_V1
void raptor_www_finish(void);
RAPTOR_API RAPTOR_V1
void raptor_www_no_www_library_init_finish(void);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
int raptor_www_init_v2(raptor_world* world);
RAPTOR_API RAPTOR_API
void raptor_www_finish_v2(raptor_world* world); raptor_www* raptor_new_www(raptor_world* world);
RAPTOR_API
void raptor_www_no_www_library_init_finish_v2(raptor_world* world);
#endif
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_www *raptor_www_new(void);
RAPTOR_API RAPTOR_V1
raptor_www *raptor_www_new_with_connection(void* connection);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
raptor_www *raptor_www_new_v2(raptor_world* world);
RAPTOR_API RAPTOR_API
raptor_www *raptor_www_new_with_connection_v2(raptor_world* world, void* co raptor_www* raptor_new_www_with_connection(raptor_world* world, void* conne
nnection); ction);
#endif
RAPTOR_API RAPTOR_API
void raptor_www_free(raptor_www *www); void raptor_free_www(raptor_www *www);
RAPTOR_API RAPTOR_API
void raptor_www_set_user_agent(raptor_www *www, const char *user_agent); void raptor_www_set_user_agent(raptor_www *www, const char *user_agent);
RAPTOR_API RAPTOR_API
void raptor_www_set_proxy(raptor_www *www, const char *proxy); void raptor_www_set_proxy(raptor_www *www, const char *proxy);
RAPTOR_API RAPTOR_API
void raptor_www_set_http_accept(raptor_www *www, const char *value); void raptor_www_set_http_accept(raptor_www *www, const char *value);
RAPTOR_API RAPTOR_API
void raptor_www_set_write_bytes_handler(raptor_www *www, raptor_www_write_b ytes_handler handler, void *user_data); void raptor_www_set_write_bytes_handler(raptor_www *www, raptor_www_write_b ytes_handler handler, void *user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_content_type_handler(raptor_www *www, raptor_www_conten t_type_handler handler, void *user_data); void raptor_www_set_content_type_handler(raptor_www *www, raptor_www_conten t_type_handler handler, void *user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_final_uri_handler(raptor_www* www, raptor_www_final_uri _handler handler, void *user_data); void raptor_www_set_final_uri_handler(raptor_www* www, raptor_www_final_uri _handler handler, void *user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_error_handler(raptor_www *www, raptor_message_handler e
rror_handler, void *error_data);
RAPTOR_API
void raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func filt er, void* user_data); void raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func filt er, void* user_data);
RAPTOR_API RAPTOR_API
void raptor_www_set_connection_timeout(raptor_www* www, int timeout); void raptor_www_set_connection_timeout(raptor_www* www, int timeout);
RAPTOR_API RAPTOR_API
int raptor_www_set_http_cache_control(raptor_www* www, const char* cache_co ntrol); int raptor_www_set_http_cache_control(raptor_www* www, const char* cache_co ntrol);
RAPTOR_API RAPTOR_API
int raptor_www_fetch(raptor_www *www, raptor_uri *uri); int raptor_www_fetch(raptor_www *www, raptor_uri *uri);
RAPTOR_API RAPTOR_API
int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void **str ing_p, size_t *length_p, void *(*malloc_handler)(size_t size)); int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void **str ing_p, size_t *length_p, raptor_data_malloc_handler const malloc_handler);
RAPTOR_API RAPTOR_API
void* raptor_www_get_connection(raptor_www *www); void* raptor_www_get_connection(raptor_www *www);
RAPTOR_API RAPTOR_API
void raptor_www_abort(raptor_www *www, const char *reason); void raptor_www_abort(raptor_www *www, const char *reason);
RAPTOR_API RAPTOR_API
raptor_uri* raptor_www_get_final_uri(raptor_www* www); raptor_uri* raptor_www_get_final_uri(raptor_www* www);
/* raptor_qname - XML qnames */ /* XML QNames Class */
RAPTOR_API RAPTOR_API
raptor_qname* raptor_new_qname(raptor_namespace_stack *nstack, const unsign raptor_qname* raptor_new_qname(raptor_namespace_stack *nstack, const unsign
ed char *name, const unsigned char *value, raptor_simple_message_handler er ed char *name, const unsigned char *value);
ror_handler, void *error_data);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_qname* raptor_new_qname_from_namespace_local_name(raptor_namespace *
ns, const unsigned char *local_name, const unsigned char *value);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_qname* raptor_new_qname_from_namespace_local_name_v2(raptor_world* w raptor_qname* raptor_new_qname_from_namespace_local_name(raptor_world* worl
orld, raptor_namespace *ns, const unsigned char *local_name, const unsigned d, raptor_namespace *ns, const unsigned char *local_name, const unsigned ch
char *value); ar *value);
#endif
/* methods */
RAPTOR_API RAPTOR_API
raptor_qname* raptor_qname_copy(raptor_qname *qname); raptor_qname* raptor_qname_copy(raptor_qname *qname);
RAPTOR_API RAPTOR_API
void raptor_free_qname(raptor_qname* name); void raptor_free_qname(raptor_qname* name);
RAPTOR_API RAPTOR_API
int raptor_qname_equal(raptor_qname *name1, raptor_qname *name2); int raptor_qname_equal(raptor_qname *name1, raptor_qname *name2);
/* utility function */
RAPTOR_API
raptor_uri* raptor_qname_string_to_uri(raptor_namespace_stack *nstack, con
st unsigned char *name, size_t name_len, raptor_simple_message_handler erro
r_handler, void *error_data);
RAPTOR_API
int raptor_iostream_write_qname(raptor_iostream* iostr, raptor_qname *qname
);
RAPTOR_API RAPTOR_API
unsigned char* raptor_qname_to_counted_name(raptor_qname *qname, size_t* le ngth_p); unsigned char* raptor_qname_to_counted_name(raptor_qname *qname, size_t* le ngth_p);
RAPTOR_API RAPTOR_API
const raptor_namespace* raptor_qname_get_namespace(raptor_qname* name); const raptor_namespace* raptor_qname_get_namespace(raptor_qname* name);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_qname_get_local_name(raptor_qname* name); const unsigned char* raptor_qname_get_local_name(raptor_qname* name);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_qname_get_value(raptor_qname* name); const unsigned char* raptor_qname_get_value(raptor_qname* name);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_qname_get_counted_value(raptor_qname* name, siz e_t* length_p); const unsigned char* raptor_qname_get_counted_value(raptor_qname* name, siz e_t* length_p);
RAPTOR_API
int raptor_qname_write(raptor_qname *qname, raptor_iostream* iostr);
/* raptor_namespace_stack - stack of XML namespaces */ /* QName String utility functions */
RAPTOR_API
raptor_uri* raptor_qname_string_to_uri(raptor_namespace_stack *nstack, con
st unsigned char *name, size_t name_len);
/* XML Namespaces Stack class */
RAPTOR_API RAPTOR_API
raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack *nst ack, const unsigned char *prefix, raptor_uri* ns_uri, int depth); raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack *nst ack, const unsigned char *prefix, raptor_uri* ns_uri, int depth);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_namespace_stack* raptor_new_namespaces(const raptor_uri_handler *uri
_handler, void *uri_context, raptor_simple_message_handler error_handler, v
oid *error_data, int defaults);
RAPTOR_API RAPTOR_V1
int raptor_namespaces_init(raptor_namespace_stack *nstack, const raptor_uri
_handler *uri_handler, void *uri_context, raptor_simple_message_handler err
or_handler, void *error_data, int defaults);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_namespace_stack* raptor_new_namespaces_v2(raptor_world* world, rapto r_simple_message_handler error_handler, void *error_data, int defaults); raptor_namespace_stack* raptor_new_namespaces(raptor_world* world, int defa ults);
RAPTOR_API RAPTOR_API
int raptor_namespaces_init_v2(raptor_world* world, raptor_namespace_stack * int raptor_namespaces_init(raptor_world* world, raptor_namespace_stack *nst
nstack, raptor_simple_message_handler error_handler, void *error_data, int ack, int defaults);
defaults);
#endif
RAPTOR_API RAPTOR_API
void raptor_namespaces_clear(raptor_namespace_stack *nstack); void raptor_namespaces_clear(raptor_namespace_stack *nstack);
RAPTOR_API RAPTOR_API
void raptor_free_namespaces(raptor_namespace_stack *nstack); void raptor_free_namespaces(raptor_namespace_stack *nstack);
/* methods */
RAPTOR_API RAPTOR_API
void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack, rapt or_namespace *nspace); void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack, rapt or_namespace *nspace);
RAPTOR_API RAPTOR_API
int raptor_namespaces_start_namespace_full(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth) ; int raptor_namespaces_start_namespace_full(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth) ;
RAPTOR_API RAPTOR_API
void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack, int de pth); void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack, int de pth);
RAPTOR_API RAPTOR_API
raptor_namespace* raptor_namespaces_get_default_namespace(raptor_namespace_ stack *nstack); raptor_namespace* raptor_namespaces_get_default_namespace(raptor_namespace_ stack *nstack);
RAPTOR_API RAPTOR_API
raptor_namespace *raptor_namespaces_find_namespace(raptor_namespace_stack * nstack, const unsigned char *prefix, int prefix_length); raptor_namespace* raptor_namespaces_find_namespace(raptor_namespace_stack * nstack, const unsigned char *prefix, int prefix_length);
RAPTOR_API RAPTOR_API
raptor_namespace* raptor_namespaces_find_namespace_by_uri(raptor_namespace_ stack *nstack, raptor_uri *ns_uri); raptor_namespace* raptor_namespaces_find_namespace_by_uri(raptor_namespace_ stack *nstack, raptor_uri *ns_uri);
RAPTOR_API RAPTOR_API
int raptor_namespaces_namespace_in_scope(raptor_namespace_stack *nstack, co nst raptor_namespace *nspace); int raptor_namespaces_namespace_in_scope(raptor_namespace_stack *nstack, co nst raptor_namespace *nspace);
RAPTOR_API RAPTOR_API
raptor_qname* raptor_namespaces_qname_from_uri(raptor_namespace_stack *nsta ck, raptor_uri *uri, int xml_version); raptor_qname* raptor_new_qname_from_namespace_uri(raptor_namespace_stack *n stack, raptor_uri *uri, int xml_version);
/* raptor_namespace - XML namespace */ /* XML Namespace Class */
RAPTOR_API RAPTOR_API
raptor_namespace* raptor_new_namespace(raptor_namespace_stack *nstack, cons t unsigned char *prefix, const unsigned char *ns_uri_string, int depth); raptor_namespace* raptor_new_namespace(raptor_namespace_stack *nstack, cons t unsigned char *prefix, const unsigned char *ns_uri_string, int depth);
RAPTOR_API RAPTOR_API
void raptor_free_namespace(raptor_namespace *ns); void raptor_free_namespace(raptor_namespace *ns);
RAPTOR_API RAPTOR_API
int raptor_namespace_copy(raptor_namespace_stack *nstack, raptor_namespace *ns, int new_depth); int raptor_namespace_stack_start_namespace(raptor_namespace_stack *nstack, raptor_namespace *ns, int new_depth);
RAPTOR_API RAPTOR_API
raptor_uri* raptor_namespace_get_uri(const raptor_namespace *ns); raptor_uri* raptor_namespace_get_uri(const raptor_namespace *ns);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_namespace_get_prefix(const raptor_namespace *ns ); const unsigned char* raptor_namespace_get_prefix(const raptor_namespace *ns );
RAPTOR_API RAPTOR_API
const unsigned char* raptor_namespace_get_counted_prefix(const raptor_names pace *ns, size_t *length_p); const unsigned char* raptor_namespace_get_counted_prefix(const raptor_names pace *ns, size_t *length_p);
RAPTOR_API RAPTOR_API
unsigned char *raptor_namespaces_format(const raptor_namespace *ns, size_t *length_p); unsigned char* raptor_namespace_format_as_xml(const raptor_namespace *ns, s ize_t *length_p);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_namespace(raptor_iostream* iostr, raptor_namespac int raptor_namespace_write(raptor_namespace *ns, raptor_iostream* iostr);
e *ns);
/* namespace string utility function */
RAPTOR_API RAPTOR_API
int raptor_new_namespace_parts_from_string(const unsigned char *string, uns igned char **prefix, unsigned char **uri_string); int raptor_xml_namespace_string_parse(const unsigned char *string, unsigned char **prefix, unsigned char **uri_string);
/** /**
* raptor_stringbuffer: * raptor_stringbuffer:
* *
* Raptor string buffer class * Raptor string buffer class
*/ */
typedef struct raptor_stringbuffer_s raptor_stringbuffer; typedef struct raptor_stringbuffer_s raptor_stringbuffer;
/* Sequence class */ /* Sequence class */
/** /**
* raptor_sequence: * raptor_sequence:
* *
* Raptor sequence class * Raptor sequence class
*/ */
typedef struct raptor_sequence_s raptor_sequence; typedef struct raptor_sequence_s raptor_sequence;
/** /* Sequence Class */
* raptor_sequence_free_handler:
* @object: object to free
*
* Handler function for freeing a sequence item.
*
* Set by raptor_new_sequence().
*/
typedef void (raptor_sequence_free_handler(void* object));
#ifdef RAPTOR_V2_AVAILABLE
/**
* raptor_sequence_free_handler_v2:
* @context: context data for the free handler
* @object: object to free
*
* Handler function for freeing a sequence item.
*
* Set by raptor_new_sequence_v2().
*/
typedef void (raptor_sequence_free_handler_v2(void* context, void* object))
;
#endif
/**
* raptor_sequence_print_handler:
* @object: object to print
* @fh: FILE* to print to
*
* Handler function for printing a sequence item.
*
* Set by raptor_new_sequence() or raptor_sequence_set_print_handler().
*/
typedef void (raptor_sequence_print_handler(void *object, FILE *fh));
#ifdef RAPTOR_V2_AVAILABLE
/**
* raptor_sequence_print_handler_v2:
* @context: context data for the print handler
* @object: object to print
* @fh: FILE* to print to
*
* Handler function for printing a sequence item.
*
* Set by raptor_new_sequence_v2() or raptor_sequence_set_print_handler_v2(
).
*/
typedef void (raptor_sequence_print_handler_v2(void *context, void *object,
FILE *fh));
#endif
/* Create */
RAPTOR_API RAPTOR_API
raptor_sequence* raptor_new_sequence(raptor_sequence_free_handler* free_han raptor_sequence* raptor_new_sequence(raptor_data_free_handler free_handler,
dler, raptor_sequence_print_handler* print_handler); raptor_data_print_handler print_handler);
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_sequence* raptor_new_sequence_v2(raptor_sequence_free_handler_v2* fr raptor_sequence* raptor_new_sequence_with_context(raptor_data_context_free_
ee_handler, raptor_sequence_print_handler_v2* print_handler, void* handler_ handler free_handler, raptor_data_context_print_handler print_handler, void
context); * handler_context);
#endif
/* Destroy */
RAPTOR_API RAPTOR_API
void raptor_free_sequence(raptor_sequence* seq); void raptor_free_sequence(raptor_sequence* seq);
/* Methods */
/* methods */
RAPTOR_API RAPTOR_API
int raptor_sequence_size(raptor_sequence* seq); int raptor_sequence_size(raptor_sequence* seq);
RAPTOR_API RAPTOR_API
int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data); int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data);
RAPTOR_API RAPTOR_API
int raptor_sequence_push(raptor_sequence* seq, void *data); int raptor_sequence_push(raptor_sequence* seq, void *data);
RAPTOR_API RAPTOR_API
int raptor_sequence_shift(raptor_sequence* seq, void *data); int raptor_sequence_shift(raptor_sequence* seq, void *data);
RAPTOR_API RAPTOR_API
void* raptor_sequence_get_at(raptor_sequence* seq, int idx); void* raptor_sequence_get_at(raptor_sequence* seq, int idx);
RAPTOR_API RAPTOR_API
void* raptor_sequence_pop(raptor_sequence* seq); void* raptor_sequence_pop(raptor_sequence* seq);
RAPTOR_API RAPTOR_API
void* raptor_sequence_unshift(raptor_sequence* seq); void* raptor_sequence_unshift(raptor_sequence* seq);
RAPTOR_API RAPTOR_API
void* raptor_sequence_delete_at(raptor_sequence* seq, int idx); void* raptor_sequence_delete_at(raptor_sequence* seq, int idx);
RAPTOR_API RAPTOR_API
int raptor_compare_strings(const void *a, const void *b); void raptor_sequence_sort(raptor_sequence* seq, raptor_data_compare_handler
compare);
RAPTOR_API
void raptor_sequence_sort(raptor_sequence* seq, int(*compare)(const void *,
const void *));
/* helper for printing sequences of strings */ /* helper for printing sequences of strings */
RAPTOR_API RAPTOR_API
void raptor_sequence_print_string(char *data, FILE *fh); int raptor_sequence_print(raptor_sequence* seq, FILE* fh);
RAPTOR_API RAPTOR_DEPRECATED
void raptor_sequence_print_uri(char *data, FILE *fh);
RAPTOR_API
void raptor_sequence_set_print_handler(raptor_sequence *seq, raptor_sequenc
e_print_handler *print_handler);
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
void raptor_sequence_set_print_handler_v2(raptor_sequence *seq, raptor_sequ
ence_print_handler_v2 *print_handler);
#endif
RAPTOR_API
void raptor_sequence_print(raptor_sequence* seq, FILE* fh);
RAPTOR_API RAPTOR_API
int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src); int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src);
/* Unicode and UTF8 */ /* Unicode and UTF8 */
/** /**
* raptor_unichar: * raptor_unichar:
* *
* raptor Unicode codepoint * raptor Unicode codepoint
*/ */
typedef unsigned long raptor_unichar; typedef unsigned long raptor_unichar;
RAPTOR_API RAPTOR_API
int raptor_unicode_char_to_utf8(raptor_unichar c, unsigned char *output); int raptor_unicode_utf8_string_put_char(raptor_unichar c, unsigned char *ou tput, size_t length);
RAPTOR_API RAPTOR_API
int raptor_utf8_to_unicode_char(raptor_unichar *output, const unsigned char *input, int length); int raptor_unicode_utf8_string_get_char(const unsigned char *input, size_t length, raptor_unichar *output);
RAPTOR_API RAPTOR_API
int raptor_unicode_is_xml11_namestartchar(raptor_unichar c); int raptor_unicode_is_xml11_namestartchar(raptor_unichar c);
RAPTOR_API RAPTOR_API
int raptor_unicode_is_xml10_namestartchar(raptor_unichar c); int raptor_unicode_is_xml10_namestartchar(raptor_unichar c);
RAPTOR_API RAPTOR_API
int raptor_unicode_is_xml11_namechar(raptor_unichar c); int raptor_unicode_is_xml11_namechar(raptor_unichar c);
RAPTOR_API RAPTOR_API
int raptor_unicode_is_xml10_namechar(raptor_unichar c); int raptor_unicode_is_xml10_namechar(raptor_unichar c);
RAPTOR_API RAPTOR_API
int raptor_utf8_check(const unsigned char *string, size_t length); int raptor_unicode_check_utf8_string(const unsigned char *string, size_t le ngth);
/* raptor_stringbuffer */ /* Stringbuffer Class */
RAPTOR_API RAPTOR_API
raptor_stringbuffer* raptor_new_stringbuffer(void); raptor_stringbuffer* raptor_new_stringbuffer(void);
RAPTOR_API RAPTOR_API
void raptor_free_stringbuffer(raptor_stringbuffer *stringbuffer); void raptor_free_stringbuffer(raptor_stringbuffer *stringbuffer);
/* methods */
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_append_counted_string(raptor_stringbuffer* stringbu ffer, const unsigned char *string, size_t length, int do_copy); int raptor_stringbuffer_append_counted_string(raptor_stringbuffer* stringbu ffer, const unsigned char *string, size_t length, int do_copy);
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_append_string(raptor_stringbuffer* stringbuffer, co nst unsigned char *string, int do_copy); int raptor_stringbuffer_append_string(raptor_stringbuffer* stringbuffer, co nst unsigned char *string, int do_copy);
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_append_decimal(raptor_stringbuffer* stringbuffer, i nt integer); int raptor_stringbuffer_append_decimal(raptor_stringbuffer* stringbuffer, i nt integer);
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer* stringbuff er, raptor_stringbuffer* append); int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer* stringbuff er, raptor_stringbuffer* append);
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer* stringb uffer, const unsigned char *string, size_t length, int do_copy); int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer* stringb uffer, const unsigned char *string, size_t length, int do_copy);
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_prepend_string(raptor_stringbuffer* stringbuffer, c onst unsigned char *string, int do_copy); int raptor_stringbuffer_prepend_string(raptor_stringbuffer* stringbuffer, c onst unsigned char *string, int do_copy);
RAPTOR_API RAPTOR_API
unsigned char * raptor_stringbuffer_as_string(raptor_stringbuffer* stringbu ffer); unsigned char* raptor_stringbuffer_as_string(raptor_stringbuffer* stringbuf fer);
RAPTOR_API RAPTOR_API
size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer); size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer);
RAPTOR_API RAPTOR_API
int raptor_stringbuffer_copy_to_string(raptor_stringbuffer* stringbuffer, u nsigned char *string, size_t length); int raptor_stringbuffer_copy_to_string(raptor_stringbuffer* stringbuffer, u nsigned char *string, size_t length);
/** /**
* raptor_iostream_init_func: * raptor_iostream_init_func:
* @context: stream context data * @context: stream context data
* *
* Handler function for #raptor_iostream initialising. * Handler function for #raptor_iostream initialising.
skipping to change at line 1697 skipping to change at line 1423
* Return value: non-0 on failure. * Return value: non-0 on failure.
*/ */
typedef int (*raptor_iostream_write_bytes_func) (void *context, const void *ptr, size_t size, size_t nmemb); typedef int (*raptor_iostream_write_bytes_func) (void *context, const void *ptr, size_t size, size_t nmemb);
/** /**
* raptor_iostream_write_end_func: * raptor_iostream_write_end_func:
* @context: stream context data * @context: stream context data
* *
* Handler function for implementing raptor_iostream_write_end(). * Handler function for implementing raptor_iostream_write_end().
* *
* Return value: non-0 on failure.
*/ */
typedef void (*raptor_iostream_write_end_func) (void *context); typedef int (*raptor_iostream_write_end_func) (void *context);
/** /**
* raptor_iostream_read_bytes_func: * raptor_iostream_read_bytes_func:
* @context: stream context data * @context: stream context data
* @ptr: pointer to buffer to read into * @ptr: pointer to buffer to read into
* @size: size of buffer * @size: size of buffer
* @nmemb: number of items * @nmemb: number of items
* *
* Handler function for implementing raptor_iostream_read_bytes(). * Handler function for implementing raptor_iostream_read_bytes().
* *
skipping to change at line 1723 skipping to change at line 1450
/** /**
* raptor_iostream_read_eof_func: * raptor_iostream_read_eof_func:
* @context: stream context data * @context: stream context data
* *
* Handler function for implementing raptor_iostream_read_eof(). * Handler function for implementing raptor_iostream_read_eof().
* *
* Return value: non-0 if EOF * Return value: non-0 if EOF
*/ */
typedef int (*raptor_iostream_read_eof_func) (void *context); typedef int (*raptor_iostream_read_eof_func) (void *context);
#ifndef RAPTOR_DISABLE_DEPRECATED
/** /**
* raptor_iostream_handler: * raptor_iostream_handler:
* @init: initialisation handler - optional, called at most once
* @finish: finishing handler - optional, called at most once
* @write_byte: write byte handler - required (for writing)
* @write_bytes: write bytes handler - required (for writing)
* @write_end: write end handler - optional (for writing), called at most o
nce
*
* I/O stream implementation handler structure.
*
* DEPRECATED: Use #raptor_iostream_handler2
*/
typedef struct {
raptor_iostream_init_func init;
raptor_iostream_finish_func finish;
raptor_iostream_write_byte_func write_byte;
raptor_iostream_write_bytes_func write_bytes;
raptor_iostream_write_end_func write_end;
} raptor_iostream_handler;
#endif
/**
* raptor_iostream_handler2:
* @version: interface version. Presently 1 or 2. * @version: interface version. Presently 1 or 2.
* @init: initialisation handler - optional, called at most once (V1) * @init: initialisation handler - optional, called at most once (V1)
* @finish: finishing handler - optional, called at most once (V1) * @finish: finishing handler - optional, called at most once (V1)
* @write_byte: write byte handler - required (for writing) (V1) * @write_byte: write byte handler - required (for writing) (V1)
* @write_bytes: write bytes handler - required (for writing) (V1) * @write_bytes: write bytes handler - required (for writing) (V1)
* @write_end: write end handler - optional (for writing), called at most o nce (V1) * @write_end: write end handler - optional (for writing), called at most o nce (V1)
* @read_bytes: read bytes handler - required (for reading) (V2) * @read_bytes: read bytes handler - required (for reading) (V2)
* @read_eof: read EOF handler - required (for reading) (V2) * @read_eof: read EOF handler - required (for reading) (V2)
* *
* I/O stream implementation handler structure. * I/O stream implementation handler structure.
skipping to change at line 1772 skipping to change at line 1477
/* V1 functions */ /* V1 functions */
raptor_iostream_init_func init; raptor_iostream_init_func init;
raptor_iostream_finish_func finish; raptor_iostream_finish_func finish;
raptor_iostream_write_byte_func write_byte; raptor_iostream_write_byte_func write_byte;
raptor_iostream_write_bytes_func write_bytes; raptor_iostream_write_bytes_func write_bytes;
raptor_iostream_write_end_func write_end; raptor_iostream_write_end_func write_end;
/* V2 functions */ /* V2 functions */
raptor_iostream_read_bytes_func read_bytes; raptor_iostream_read_bytes_func read_bytes;
raptor_iostream_read_eof_func read_eof; raptor_iostream_read_eof_func read_eof;
} raptor_iostream_handler2; } raptor_iostream_handler;
#ifndef RAPTOR_DISABLE_DEPRECATED /* I/O Stream Class */
RAPTOR_API RAPTOR_DEPRECATED
raptor_iostream* raptor_new_iostream_from_handler(void *context, const rapt
or_iostream_handler *handler);
#endif
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_handler2(void *user_data, const r aptor_iostream_handler2* const handler2); raptor_iostream* raptor_new_iostream_from_handler(raptor_world* world, void *user_data, const raptor_iostream_handler* const handler);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_sink(void); raptor_iostream* raptor_new_iostream_to_sink(raptor_world* world);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_filename(const char *filename); raptor_iostream* raptor_new_iostream_to_filename(raptor_world* world, const char *filename);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_file_handle(FILE *handle); raptor_iostream* raptor_new_iostream_to_file_handle(raptor_world* world, FI LE *handle);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_to_string(void **string_p, size_t *len gth_p, void *(*malloc_handler)(size_t size)); raptor_iostream* raptor_new_iostream_to_string(raptor_world* world, void ** string_p, size_t *length_p, raptor_data_malloc_handler const malloc_handler );
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_sink(void); raptor_iostream* raptor_new_iostream_from_sink(raptor_world* world);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_filename(const char *filename); raptor_iostream* raptor_new_iostream_from_filename(raptor_world* world, con st char *filename);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_file_handle(FILE *handle); raptor_iostream* raptor_new_iostream_from_file_handle(raptor_world* world, FILE *handle);
RAPTOR_API RAPTOR_API
raptor_iostream* raptor_new_iostream_from_string(void *string, size_t lengt h); raptor_iostream* raptor_new_iostream_from_string(raptor_world* world, void *string, size_t length);
RAPTOR_API RAPTOR_API
void raptor_free_iostream(raptor_iostream *iostr); void raptor_free_iostream(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_bytes(raptor_iostream *iostr, const void *ptr, si ze_t size, size_t nmemb); int raptor_iostream_write_bytes(const void *ptr, size_t size, size_t nmemb, raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte); int raptor_iostream_write_byte(const int byte, raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
void raptor_iostream_write_end(raptor_iostream *iostr); int raptor_iostream_write_end(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_string(raptor_iostream *iostr, const void *string ); int raptor_iostream_string_write(const void *string, raptor_iostream *iostr );
RAPTOR_API RAPTOR_API
int raptor_iostream_write_counted_string(raptor_iostream *iostr, const void int raptor_iostream_counted_string_write(const void *string, size_t len, ra
*string, size_t len); ptor_iostream *iostr);
#ifndef RAPTOR_DISABLE_DEPRECATED
RAPTOR_API RAPTOR_DEPRECATED
size_t raptor_iostream_get_bytes_written_count(raptor_iostream *iostr);
#endif
RAPTOR_API RAPTOR_API
unsigned long raptor_iostream_tell(raptor_iostream *iostr); unsigned long raptor_iostream_tell(raptor_iostream *iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_decimal(raptor_iostream* iostr, int integer); int raptor_iostream_decimal_write(int integer, raptor_iostream* iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_format_hexadecimal(raptor_iostream* iostr, unsigned int integer, int width); int raptor_iostream_hexadecimal_write(unsigned int integer, int width, rapt or_iostream* iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_stringbuffer(raptor_iostream* iostr, raptor_strin int raptor_stringbuffer_write(raptor_stringbuffer *sb, raptor_iostream* ios
gbuffer *sb); tr);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
int raptor_iostream_write_uri(raptor_iostream *iostr, raptor_uri *uri);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
int raptor_iostream_write_uri_v2(raptor_world* world, raptor_iostream *iost int raptor_uri_write(raptor_uri *uri, raptor_iostream *iostr);
r, raptor_uri *uri);
#endif
RAPTOR_API RAPTOR_API
int raptor_iostream_read_bytes(raptor_iostream* iostr, void *ptr, size_t si ze, size_t nmemb); int raptor_iostream_read_bytes(void *ptr, size_t size, size_t nmemb, raptor _iostream* iostr);
RAPTOR_API RAPTOR_API
int raptor_iostream_read_eof(raptor_iostream *iostr); int raptor_iostream_read_eof(raptor_iostream *iostr);
/* Parser and Serializer features */ /* I/O Stream utility functions */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_feature raptor_feature_from_uri(raptor_uri *uri);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_feature raptor_feature_from_uri_v2(raptor_world* world, raptor_uri * int raptor_string_ntriples_write(const unsigned char *string, size_t len, c
uri); onst char delim, raptor_iostream *iostr);
#endif
RAPTOR_API RAPTOR_API
int raptor_feature_value_type(const raptor_feature feature); int raptor_string_python_write(const unsigned char *string, size_t len, con
st char delim, int flags, raptor_iostream *iostr);
RAPTOR_API
int raptor_statement_ntriples_write(const raptor_statement *statement, rapt
or_iostream* iostr, int write_graph_term);
/* Parser and Serializer options */
/**
* raptor_option_value_type:
* @RAPTOR_OPTION_VALUE_TYPE_BOOL: Boolean integer value. Non-0 is true
* @RAPTOR_OPTION_VALUE_TYPE_INT: Decimal integer value
* @RAPTOR_OPTION_VALUE_TYPE_STRING: String value
* @RAPTOR_OPTION_VALUE_TYPE_URI: URI String value.
* @RAPTOR_OPTION_VALUE_TYPE_LAST: internal
*
* Option value types.
*/
typedef enum {
RAPTOR_OPTION_VALUE_TYPE_BOOL,
RAPTOR_OPTION_VALUE_TYPE_INT,
RAPTOR_OPTION_VALUE_TYPE_STRING,
RAPTOR_OPTION_VALUE_TYPE_URI,
RAPTOR_OPTION_VALUE_TYPE_LAST = RAPTOR_OPTION_VALUE_TYPE_URI
} raptor_option_value_type;
/**
* raptor_option_description:
* @domain: domain ID
* @option: option ID
* @value_type: data type of option value
* @name: short name for option
* @name_len: length of @name
* @label: description of option
* @uri: URI identifying option
*
* Description of an option for a domain.
*/
typedef struct {
raptor_domain domain;
raptor_option option;
raptor_option_value_type value_type;
const char* name;
size_t name_len;
const char* label;
raptor_uri* uri;
} raptor_option_description;
RAPTOR_API
unsigned int raptor_option_get_count(void);
RAPTOR_API
const char* raptor_option_get_value_type_label(const raptor_option_value_ty
pe type);
RAPTOR_API
void raptor_free_option_description(raptor_option_description* option_descr
iption);
RAPTOR_API
raptor_option_description* raptor_world_get_option_description(raptor_world
* world, const raptor_domain domain, const raptor_option option);
/* SAX2 element Class (raptor_xml_element) */ /* SAX2 element Class (raptor_xml_element) */
RAPTOR_API RAPTOR_API
raptor_xml_element* raptor_new_xml_element(raptor_qname* name, const unsign ed char* xml_language, raptor_uri* xml_base); raptor_xml_element* raptor_new_xml_element(raptor_qname* name, const unsign ed char* xml_language, raptor_uri* xml_base);
RAPTOR_API RAPTOR_API
raptor_xml_element* raptor_new_xml_element_from_namespace_local_name(raptor _namespace *ns, const unsigned char *name, const unsigned char *xml_languag e, raptor_uri *xml_base); raptor_xml_element* raptor_new_xml_element_from_namespace_local_name(raptor _namespace *ns, const unsigned char *name, const unsigned char *xml_languag e, raptor_uri *xml_base);
RAPTOR_API RAPTOR_API
void raptor_free_xml_element(raptor_xml_element *element); void raptor_free_xml_element(raptor_xml_element *element);
/* methods */
RAPTOR_API RAPTOR_API
raptor_qname* raptor_xml_element_get_name(raptor_xml_element *xml_element); raptor_qname* raptor_xml_element_get_name(raptor_xml_element *xml_element);
RAPTOR_API RAPTOR_API
void raptor_xml_element_set_attributes(raptor_xml_element* xml_element, rap tor_qname **attributes, int count); void raptor_xml_element_set_attributes(raptor_xml_element* xml_element, rap tor_qname **attributes, int count);
RAPTOR_API RAPTOR_API
raptor_qname** raptor_xml_element_get_attributes(raptor_xml_element* xml_el ement); raptor_qname** raptor_xml_element_get_attributes(raptor_xml_element* xml_el ement);
RAPTOR_API RAPTOR_API
int raptor_xml_element_get_attributes_count(raptor_xml_element* xml_element ); int raptor_xml_element_get_attributes_count(raptor_xml_element* xml_element );
RAPTOR_API RAPTOR_API
int raptor_xml_element_declare_namespace(raptor_xml_element* xml_element, r aptor_namespace *nspace); int raptor_xml_element_declare_namespace(raptor_xml_element* xml_element, r aptor_namespace *nspace);
RAPTOR_API RAPTOR_API
int raptor_iostream_write_xml_element(raptor_iostream *iostr, raptor_xml_el ement *element, raptor_namespace_stack *nstack, int is_empty, int is_end, r aptor_simple_message_handler error_handler, void *error_data, int depth); int raptor_xml_element_write(raptor_xml_element *element, raptor_namespace_ stack *nstack, int is_empty, int is_end, int depth, raptor_iostream *iostr) ;
RAPTOR_API RAPTOR_API
int raptor_xml_element_is_empty(raptor_xml_element* xml_element); int raptor_xml_element_is_empty(raptor_xml_element* xml_element);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_xml_element_get_language(raptor_xml_element* xm l_element); const unsigned char* raptor_xml_element_get_language(raptor_xml_element* xm l_element);
/* XML Writer Class (raptor_xml_writer) */ /* XML Writer Class (raptor_xml_writer) */
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
raptor_xml_writer* raptor_new_xml_writer(raptor_namespace_stack *nstack, co
nst raptor_uri_handler *uri_handler, void *uri_context, raptor_iostream* io
str, raptor_simple_message_handler error_handler, void *error_data, int can
onicalize);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API RAPTOR_API
raptor_xml_writer* raptor_new_xml_writer_v2(raptor_world* world, raptor_nam raptor_xml_writer* raptor_new_xml_writer(raptor_world* world, raptor_namesp
espace_stack *nstack, raptor_iostream* iostr, raptor_simple_message_handler ace_stack *nstack, raptor_iostream* iostr);
error_handler, void *error_data, int canonicalize);
#endif
RAPTOR_API RAPTOR_API
void raptor_free_xml_writer(raptor_xml_writer* xml_writer); void raptor_free_xml_writer(raptor_xml_writer* xml_writer);
/* methods */
RAPTOR_API RAPTOR_API
void raptor_xml_writer_empty_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element); void raptor_xml_writer_empty_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_start_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element); void raptor_xml_writer_start_element(raptor_xml_writer* xml_writer, raptor_ xml_element *element);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer, raptor_xm l_element *element); void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer, raptor_xm l_element *element);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_newline(raptor_xml_writer* xml_writer); void raptor_xml_writer_newline(raptor_xml_writer* xml_writer);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_cdata(raptor_xml_writer* xml_writer, const unsigned char *s); void raptor_xml_writer_cdata(raptor_xml_writer* xml_writer, const unsigned char *s);
skipping to change at line 1903 skipping to change at line 1640
RAPTOR_API RAPTOR_API
void raptor_xml_writer_raw(raptor_xml_writer* xml_writer, const unsigned ch ar *s); void raptor_xml_writer_raw(raptor_xml_writer* xml_writer, const unsigned ch ar *s);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_raw_counted(raptor_xml_writer* xml_writer, const uns igned char *s, unsigned int len); void raptor_xml_writer_raw_counted(raptor_xml_writer* xml_writer, const uns igned char *s, unsigned int len);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_comment(raptor_xml_writer* xml_writer, const unsigne d char *s); void raptor_xml_writer_comment(raptor_xml_writer* xml_writer, const unsigne d char *s);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_comment_counted(raptor_xml_writer* xml_writer, const unsigned char *s, unsigned int len); void raptor_xml_writer_comment_counted(raptor_xml_writer* xml_writer, const unsigned char *s, unsigned int len);
RAPTOR_API RAPTOR_API
void raptor_xml_writer_flush(raptor_xml_writer* xml_writer); void raptor_xml_writer_flush(raptor_xml_writer* xml_writer);
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
int raptor_xml_writer_features_enumerate(const raptor_feature feature, cons
t char **name, raptor_uri **uri, const char **label);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
int raptor_xml_writer_features_enumerate_v2(raptor_world* world, const rapt
or_feature feature, const char **name, raptor_uri **uri, const char **labe
l);
#endif
RAPTOR_API
int raptor_xml_writer_set_feature(raptor_xml_writer *xml_writer, raptor_fea
ture feature, int value);
RAPTOR_API RAPTOR_API
int raptor_xml_writer_set_feature_string(raptor_xml_writer *xml_writer, rap int raptor_xml_writer_set_option(raptor_xml_writer *xml_writer, raptor_opti
tor_feature feature, const unsigned char *value); on option, char* string, int integer);
RAPTOR_API
int raptor_xml_writer_get_feature(raptor_xml_writer *xml_writer, raptor_fea
ture feature);
RAPTOR_API RAPTOR_API
const unsigned char *raptor_xml_writer_get_feature_string(raptor_xml_writer *xml_writer, raptor_feature feature); int raptor_xml_writer_get_option(raptor_xml_writer *xml_writer, raptor_opti on option, char** string_p, int* integer_p);
RAPTOR_API RAPTOR_API
int raptor_xml_writer_get_depth(raptor_xml_writer *xml_writer); int raptor_xml_writer_get_depth(raptor_xml_writer *xml_writer);
/** /**
* raptor_sax2_start_element_handler: * raptor_sax2_start_element_handler:
* @user_data: user data * @user_data: user data
* @xml_element: XML element * @xml_element: XML element
* *
* SAX2 start element handler * SAX2 start element handler
*/ */
skipping to change at line 2000 skipping to change at line 1725
* @systemId: system ID * @systemId: system ID
* @publicId: public ID * @publicId: public ID
* *
* SAX2 external entity reference handler * SAX2 external entity reference handler
* *
* Return value: 0 if processing should not continue because of a * Return value: 0 if processing should not continue because of a
* fatal error in the handling of the external entity. * fatal error in the handling of the external entity.
*/ */
typedef int (*raptor_sax2_external_entity_ref_handler)(void *user_data, con st unsigned char* context, const unsigned char* base, const unsigned char* systemId, const unsigned char* publicId); typedef int (*raptor_sax2_external_entity_ref_handler)(void *user_data, con st unsigned char* context, const unsigned char* base, const unsigned char* systemId, const unsigned char* publicId);
/**
* raptor_log_level:
* @RAPTOR_LOG_LEVEL_NONE: Internal
* @RAPTOR_LOG_LEVEL_FATAL: Fatal error message
* @RAPTOR_LOG_LEVEL_ERROR: Error message
* @RAPTOR_LOG_LEVEL_WARNING: Warning message
* @RAPTOR_LOG_LEVEL_LAST: Internal
*
* Log levels
*/
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;
/**
* raptor_error_handlers:
* @magic: magic value - must use raptor_error_handlers_init() to set this
* @locator: raptor locator of the error
* @last_log_level: number of log levels; size of @handlers arrays
* @handlers: user handlers per log level
* @world: raptor_world object
*
* Error handlers structure
*/
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;
#ifndef RAPTOR_DISABLE_V1
RAPTOR_API RAPTOR_V1
void raptor_error_handlers_init(raptor_error_handlers* error_handlers);
#endif
#ifdef RAPTOR_V2_AVAILABLE
RAPTOR_API
void raptor_error_handlers_init_v2(raptor_world* world, raptor_error_handle
rs* error_handlers);
#endif
/* SAX2 API */ /* SAX2 API */
RAPTOR_API RAPTOR_API
raptor_sax2* raptor_new_sax2(void *user_data, raptor_error_handlers* error_ handlers); raptor_sax2* raptor_new_sax2(raptor_world *world, raptor_locator *locator, void* user_data);
RAPTOR_API RAPTOR_API
void raptor_free_sax2(raptor_sax2 *sax2); void raptor_free_sax2(raptor_sax2 *sax2);
/* methods */
RAPTOR_API RAPTOR_API
void raptor_sax2_set_start_element_handler(raptor_sax2* sax2, raptor_sax2_s tart_element_handler handler); void raptor_sax2_set_start_element_handler(raptor_sax2* sax2, raptor_sax2_s tart_element_handler handler);
RAPTOR_API RAPTOR_API
void raptor_sax2_set_end_element_handler(raptor_sax2* sax2, raptor_sax2_end _element_handler handler); void raptor_sax2_set_end_element_handler(raptor_sax2* sax2, raptor_sax2_end _element_handler handler);
RAPTOR_API RAPTOR_API
void raptor_sax2_set_characters_handler(raptor_sax2* sax2, raptor_sax2_char acters_handler handler); void raptor_sax2_set_characters_handler(raptor_sax2* sax2, raptor_sax2_char acters_handler handler);
RAPTOR_API RAPTOR_API
void raptor_sax2_set_cdata_handler(raptor_sax2* sax2, raptor_sax2_cdata_han dler handler); void raptor_sax2_set_cdata_handler(raptor_sax2* sax2, raptor_sax2_cdata_han dler handler);
RAPTOR_API RAPTOR_API
void raptor_sax2_set_comment_handler(raptor_sax2* sax2, raptor_sax2_comment _handler handler); void raptor_sax2_set_comment_handler(raptor_sax2* sax2, raptor_sax2_comment _handler handler);
skipping to change at line 2089 skipping to change at line 1757
void raptor_sax2_set_namespace_handler(raptor_sax2* sax2, raptor_namespace_ handler handler); void raptor_sax2_set_namespace_handler(raptor_sax2* sax2, raptor_namespace_ handler handler);
RAPTOR_API RAPTOR_API
void raptor_sax2_parse_start(raptor_sax2 *sax2, raptor_uri *base_uri); void raptor_sax2_parse_start(raptor_sax2 *sax2, raptor_uri *base_uri);
RAPTOR_API RAPTOR_API
int raptor_sax2_parse_chunk(raptor_sax2* sax2, const unsigned char *buffer, size_t len, int is_end); int raptor_sax2_parse_chunk(raptor_sax2* sax2, const unsigned char *buffer, size_t len, int is_end);
RAPTOR_API RAPTOR_API
const unsigned char* raptor_sax2_inscope_xml_language(raptor_sax2* sax2); const unsigned char* raptor_sax2_inscope_xml_language(raptor_sax2* sax2);
RAPTOR_API RAPTOR_API
raptor_uri* raptor_sax2_inscope_base_uri(raptor_sax2* sax2); raptor_uri* raptor_sax2_inscope_base_uri(raptor_sax2* sax2);
/* AVL Trees */
/**
* raptor_avltree:
*
* AVL Tree
*/
typedef struct raptor_avltree_s raptor_avltree;
/**
* raptor_avltree_iterator:
*
* AVL Tree Iterator as created by raptor_new_avltree_iterator()
*/
typedef struct raptor_avltree_iterator_s raptor_avltree_iterator;
/**
* raptor_avltree_visit_handler:
* @depth: depth of object in tree
* @data: data object being visited
* @user_data: user data arg to raptor_avltree_visit()
*
* AVL Tree visitor function as given to raptor_avltree_visit()
*
* Return value: non-0 to terminate visit early.
*/
typedef int (*raptor_avltree_visit_handler)(int depth, void* data, void *us
er_data);
/**
* raptor_avltree_bitflags:
* @RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES: If set raptor_avltree_add() wil
l replace any duplicate items. If not set, raptor_avltree_add() will not re
place them and will return status >0 when adding a duplicate. (Default is n
ot set)
*
* Bit flags for AVL Tree class constructor raptor_new_avltree()
**/
typedef enum {
RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES = 1
} raptor_avltree_bitflags;
RAPTOR_API
raptor_avltree* raptor_new_avltree(raptor_data_compare_handler compare_hand
ler, raptor_data_free_handler free_handler, unsigned int flags);
RAPTOR_API
void raptor_free_avltree(raptor_avltree* tree);
/* methods */
RAPTOR_API
int raptor_avltree_add(raptor_avltree* tree, void* p_data);
RAPTOR_API
void* raptor_avltree_remove(raptor_avltree* tree, void* p_data);
RAPTOR_API
int raptor_avltree_delete(raptor_avltree* tree, void* p_data);
RAPTOR_API
void* raptor_avltree_search(raptor_avltree* tree, const void* p_data);
RAPTOR_API
int raptor_avltree_visit(raptor_avltree* tree, raptor_avltree_visit_handler
visit_handler, void* user_data);
RAPTOR_API
int raptor_avltree_size(raptor_avltree* tree);
RAPTOR_API
void raptor_avltree_set_print_handler(raptor_avltree* tree, raptor_data_pri
nt_handler print_handler);
RAPTOR_API
int raptor_avltree_print(raptor_avltree* tree, FILE* stream);
RAPTOR_API
raptor_avltree_iterator* raptor_new_avltree_iterator(raptor_avltree* tree,
void* range, raptor_data_free_handler range_free_handler, int direction);
RAPTOR_API
void raptor_free_avltree_iterator(raptor_avltree_iterator* iterator);
RAPTOR_API
int raptor_avltree_iterator_is_end(raptor_avltree_iterator* iterator);
RAPTOR_API
int raptor_avltree_iterator_next(raptor_avltree_iterator* iterator);
RAPTOR_API
void* raptor_avltree_iterator_get(raptor_avltree_iterator* iterator);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 295 change blocks. 
1181 lines changed or deleted 840 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/