1 /* -*- Mode: c; c-basic-offset: 2 -*-
3 * raptor.h - Redland Parser Toolkit for RDF (Raptor) - public API
5 * Copyright (C) 2000-2013, David Beckett http://www.dajobe.org/
6 * Copyright (C) 2000-2005, University of Bristol, UK http://www.bristol.ac.uk/
8 * This package is Free Software and part of Redland http://librdf.org/
10 * It is licensed under the following three licenses as alternatives:
11 * 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
12 * 2. GNU General Public License (GPL) V2 or any newer version
13 * 3. Apache License, V2.0 or any newer version
15 * You may not use this file except in compliance with at least one of
16 * the above three licenses.
18 * See LICENSE.html or LICENSE.txt at the top of this package for the
19 * complete terms and further detail along with the license texts for
20 * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
37 /* Required for va_list in raptor_vsnprintf */
44 * Flag for marking raptor2 API availability.
46 #define RAPTOR_V2_AVAILABLE 1
52 * Raptor library version number
54 * Format: major * 10000 + minor * 100 + release
56 #define RAPTOR_VERSION 20009
59 * RAPTOR_VERSION_STRING:
61 * Raptor library version string
63 #define RAPTOR_VERSION_STRING "2.0.9"
66 * RAPTOR_VERSION_MAJOR:
68 * Raptor library major version
70 #define RAPTOR_VERSION_MAJOR 2
73 * RAPTOR_VERSION_MINOR:
75 * Raptor library minor version
77 #define RAPTOR_VERSION_MINOR 0
80 * RAPTOR_VERSION_RELEASE:
82 * Raptor library release
84 #define RAPTOR_VERSION_RELEASE 9
89 * Macro for wrapping API function call declarations.
96 # define _declspec(x) __declspec(x)
101 # ifdef RAPTOR_INTERNAL
102 # define RAPTOR_API _declspec(dllexport)
104 # define RAPTOR_API _declspec(dllimport)
112 /* Use gcc 3.1+ feature to allow marking of deprecated API calls.
113 * This gives a warning during compiling.
115 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
116 #define RAPTOR_DEPRECATED __attribute__((deprecated))
117 #define RAPTOR_NORETURN __attribute__((__noreturn__))
119 #define RAPTOR_DEPRECATED
120 #define RAPTOR_NORETURN
124 * RAPTOR_PRINTF_FORMAT:
125 * @string_index: ignore me
126 * @first_to_check_index: ignore me
130 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
131 #define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index) \
132 __attribute__((__format__(__printf__, string_index, first_to_check_index)))
134 #define RAPTOR_PRINTF_FORMAT(string_index, first_to_check_index)
142 typedef struct raptor_uri_s raptor_uri
;
148 * raptor_short_copyright_string:
150 * Short copyright string (one line).
153 extern const char * const raptor_short_copyright_string
;
156 * raptor_copyright_string:
158 * Copyright string (multiple lines).
161 extern const char * const raptor_copyright_string
;
164 * raptor_version_string:
166 * Raptor version as a string.
169 extern const char * const raptor_version_string
;
172 * raptor_version_major:
174 * Raptor major version number.
177 extern const unsigned int raptor_version_major
;
180 * raptor_version_minor:
182 * Raptor minor version number.
185 extern const unsigned int raptor_version_minor
;
188 * raptor_version_release:
190 * Raptor release version number.
193 extern const unsigned int raptor_version_release
;
196 * raptor_version_decimal:
198 * Raptor version as a decimal number.
200 * Format: major * 10000 + minor * 100 + release
203 extern const unsigned int raptor_version_decimal
;
206 * raptor_license_string:
208 * Raptor license string.
211 extern const char * const raptor_license_string
;
214 * raptor_home_url_string:
216 * Raptor home page URL.
219 extern const char * const raptor_home_url_string
;
222 * raptor_xml_namespace_uri:
224 * XML Namespace (xml:) URI string.
227 extern const unsigned char * const raptor_xml_namespace_uri
;
231 * raptor_rdf_namespace_uri:
233 * RDF Namespace (rdf:) URI string.
236 extern const unsigned char * const raptor_rdf_namespace_uri
;
239 * raptor_rdf_namespace_uri_len:
241 * Length of #raptor_rdf_namespace_uri string
244 extern const unsigned int raptor_rdf_namespace_uri_len
;
247 * raptor_rdf_schema_namespace_uri:
249 * RDF Schema (rdfs:) Namespace URI string.
252 extern const unsigned char * const raptor_rdf_schema_namespace_uri
;
255 * raptor_xmlschema_datatypes_namespace_uri:
257 * XML Schema datatypes (xsd:) namespace URI string.
260 extern const unsigned char * const raptor_xmlschema_datatypes_namespace_uri
;
263 * raptor_owl_namespace_uri:
265 * OWL (owl:) Namespace URI string.
268 extern const unsigned char * const raptor_owl_namespace_uri
;
271 * raptor_xml_literal_datatype_uri_string:
273 * XML Literal datatype (rdf:XMLLiteral) URI string.
276 extern const unsigned char * const raptor_xml_literal_datatype_uri_string
;
279 * raptor_xml_literal_datatype_uri_string_len:
281 * Length of #raptor_xml_literal_datatype_uri_string
284 extern const unsigned int raptor_xml_literal_datatype_uri_string_len
;
287 /* Public structure */
291 * Raptor world class.
293 typedef struct raptor_world_s raptor_world
;
297 * Raptor Parser class
299 typedef struct raptor_parser_s raptor_parser
;
303 * Raptor Serializer class
305 typedef struct raptor_serializer_s raptor_serializer
;
312 typedef struct raptor_www_s raptor_www
;
316 * Raptor I/O Stream class
318 typedef struct raptor_iostream_s raptor_iostream
;
320 * raptor_xml_element:
322 * Raptor XML Element class
324 typedef struct raptor_xml_element_s raptor_xml_element
;
328 * Raptor XML Writer class
330 typedef struct raptor_xml_writer_s raptor_xml_writer
;
334 * Raptor XML qname class
336 typedef struct raptor_qname_s raptor_qname
;
340 * Raptor XML Namespace class
342 typedef struct raptor_namespace_s raptor_namespace
;
344 * raptor_namespace_stack:
346 * Raptor XML Namespace Stack class
348 typedef struct raptor_namespace_stack_s raptor_namespace_stack
;
355 typedef struct raptor_sax2_s raptor_sax2
;
360 * @mime_type: MIME type string
361 * @mime_type_len: length of @mime_type
362 * @q: Q value 0-10 standing for decimal 0.0-1.0
364 * (MIME Type, Q) pair
367 const char* mime_type
;
368 size_t mime_type_len
;
374 * raptor_syntax_bitflags:
375 * @RAPTOR_SYNTAX_NEED_BASE_URI: the syntax requires a base URI
377 * Bit flags for #raptor_syntax_description flags field
380 RAPTOR_SYNTAX_NEED_BASE_URI
= 1
381 } raptor_syntax_bitflags
;
385 * raptor_syntax_description:
386 * @names: array of syntax names - the first one (required) is the public name, the rest are aliases. The array is NULL terminated.
387 * @names_count: size of @names array
388 * @label: long descriptive label for syntax
389 * @mime_types: Array of (MIME type, Q) values associated with the syntax (or NULL). If present the array is NULL terminated.
390 * @mime_types_count: size of @mime_types array
391 * @uri_strings: array of URIs identifying the syntax (or NULL). The first one if present is the main URI, the rest are aliases. The array is NULL terminated.
392 * @uri_strings_count: size of @uri_strings array
393 * @flags: See #raptor_syntax_bitflags for the bits
395 * Description of a syntax or file format.
399 const char* const* names
;
400 unsigned int names_count
;
404 const raptor_type_q
* mime_types
;
405 unsigned int mime_types_count
;
407 const char* const* uri_strings
;
408 unsigned int uri_strings_count
;
411 } raptor_syntax_description
;
416 * @RAPTOR_TERM_TYPE_URI: RDF URI
417 * @RAPTOR_TERM_TYPE_LITERAL: RDF literal
418 * @RAPTOR_TERM_TYPE_BLANK: RDF blank node
419 * @RAPTOR_TERM_TYPE_UNKNOWN: Internal
421 * Type of term in a #raptor_statement
423 * Node type 3 is unused but exists to preserve numeric compatibility
424 * with librdf_node_type values.
427 RAPTOR_TERM_TYPE_UNKNOWN
= 0,
428 RAPTOR_TERM_TYPE_URI
= 1,
429 RAPTOR_TERM_TYPE_LITERAL
= 2,
431 RAPTOR_TERM_TYPE_BLANK
= 4
437 * @uri: URI of location (or NULL)
438 * @file: Filename of location (or NULL)
439 * @line: Line number of location (or <0 for no line)
440 * @column: Column number of location (or <0 for no column)
441 * @byte: Byte number of location (or <0 for no byte)
443 * Location information for an error, warning or information message.
455 * @RAPTOR_OPTION_SCANNING: If true (default false), the RDF/XML
456 * parser will look for embedded rdf:RDF elements inside the XML
457 * content, and not require that the XML start with an rdf:RDF root
459 * @RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES: If true (default true)
460 * then the RDF/XML parser will allow non-XML namespaced attributes
461 * to be accepted as well as rdf: namespaced ones. For example,
462 * 'about' and 'ID' will be interpreted as if they were rdf:about
463 * and rdf:ID respectively.
464 * @RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES: If true (default true)
465 * then the RDF/XML parser will allow unknown parsetypes to be
466 * present and will pass them on to the user. Unimplemented at
468 * @RAPTOR_OPTION_ALLOW_BAGID: If true (default true) then the
469 * RDF/XML parser will support the rdf:bagID attribute that was
470 * removed from the RDF/XML language when it was revised. This
471 * support may be removed in future.
472 * @RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST: If true (default false)
473 * then the RDF/XML parser will generate the idList rdf:type
474 * rdf:List triple in the handling of rdf:parseType="Collection".
475 * This triple was removed during the revising of RDF/XML after
476 * collections were initially added.
477 * @RAPTOR_OPTION_NORMALIZE_LANGUAGE: If true (default true) then
478 * XML language values such as from xml:lang will be normalized to
480 * @RAPTOR_OPTION_NON_NFC_FATAL: If true (default false) then
481 * illegal Unicode Normal Form C in literals will give a fatal
482 * error, otherwise just a warning.
483 * @RAPTOR_OPTION_WARN_OTHER_PARSETYPES: If true (default true) then
484 * the RDF/XML parser will warn about unknown rdf:parseType values.
485 * @RAPTOR_OPTION_CHECK_RDF_ID: If true (default true) then the
486 * RDF/XML will check rdf:ID attribute values for duplicates and
487 * cause an error if any are found.
488 * @RAPTOR_OPTION_RELATIVE_URIS: If true (default true) then
489 * relative URIs will be used wherever possible when serializing.
490 * @RAPTOR_OPTION_WRITER_AUTO_INDENT: Automatically indent elements when
492 * @RAPTOR_OPTION_WRITER_AUTO_EMPTY: Automatically detect and
493 * abbreviate empty elements when serializing.
494 * @RAPTOR_OPTION_WRITER_INDENT_WIDTH: Integer number of spaces to use
495 * for each indent level when serializing with auto indent.
496 * @RAPTOR_OPTION_WRITER_XML_VERSION: Integer XML version XML 1.0 (10) or XML 1.1 (11)
497 * @RAPTOR_OPTION_WRITER_XML_DECLARATION: Write XML 1.0 or 1.1 declaration.
498 * @RAPTOR_OPTION_NO_NET: Deny network requests inside other requests.
499 * @RAPTOR_OPTION_RESOURCE_BORDER: Border color of resource
500 * nodes for GraphViz DOT serializer.
501 * @RAPTOR_OPTION_LITERAL_BORDER: Border color of literal nodes
502 * for GraphViz DOT serializer.
503 * @RAPTOR_OPTION_BNODE_BORDER: Border color of blank nodes for
504 * GraphViz DOT serializer.
505 * @RAPTOR_OPTION_RESOURCE_FILL: Fill color of resource nodes
506 * for GraphViz DOT serializer.
507 * @RAPTOR_OPTION_LITERAL_FILL: Fill color of literal nodes for
508 * GraphViz DOT serializer.
509 * @RAPTOR_OPTION_BNODE_FILL: Fill color of blank nodes for
510 * GraphViz DOT serializer.
511 * @RAPTOR_OPTION_HTML_TAG_SOUP: Use a lax HTML parser if an XML parser
512 * fails when read HTML for GRDDL parser.
513 * @RAPTOR_OPTION_MICROFORMATS: Look for microformats for GRDDL parser.
514 * @RAPTOR_OPTION_HTML_LINK: Look for head <link> to type rdf/xml
516 * @RAPTOR_OPTION_WWW_TIMEOUT: Set timeout for internal WWW URI requests
518 * @RAPTOR_OPTION_WRITE_BASE_URI: Write @base directive for Turtle/N3.
519 * @RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL: HTTP Cache-Control: header
520 * @RAPTOR_OPTION_WWW_HTTP_USER_AGENT: HTTP User-Agent: header
521 * @RAPTOR_OPTION_JSON_CALLBACK: JSON serializer callback function.
522 * @RAPTOR_OPTION_JSON_EXTRA_DATA: JSON serializer extra top-level data
523 * @RAPTOR_OPTION_RSS_TRIPLES: Atom/RSS serializer writes extra RDF triples it finds (none, rdf-xml, atom-triples)
524 * @RAPTOR_OPTION_ATOM_ENTRY_URI: Atom entry URI. If given, generate an Atom Entry Document with the item having the given URI, otherwise generate an Atom Feed Document with any items found.
525 * @RAPTOR_OPTION_PREFIX_ELEMENTS: Integer. If set, generate Atom/RSS1.0 documents with prefixed elements, otherwise unprefixed.
526 * @RAPTOR_OPTION_STRICT: Boolean. If set, operate in strict conformance mode.
527 * @RAPTOR_OPTION_WWW_CERT_FILENAME: String. SSL client certificate filename
528 * @RAPTOR_OPTION_WWW_CERT_TYPE: String. SSL client certificate type
529 * @RAPTOR_OPTION_WWW_CERT_PASSPHRASE: String. SSL client certificate passphrase
530 * @RAPTOR_OPTION_WWW_SSL_VERIFY_PEER: Integer. SSL verify peer - non-0 to verify peer SSL certificate (default)
531 * @RAPTOR_OPTION_WWW_SSL_VERIFY_HOST: Integer. SSL verify host - 0 none, 1 CN match, 2 host match (default). Other values are ignored.
532 * @RAPTOR_OPTION_NO_FILE: Deny file reading requests inside other requests.
533 * @RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES: When reading XML, load external entities.
534 * @RAPTOR_OPTION_LAST: Internal
536 * Raptor parser, serializer or XML writer options.
539 RAPTOR_OPTION_SCANNING
,
540 RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES
,
541 RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES
,
542 RAPTOR_OPTION_ALLOW_BAGID
,
543 RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST
,
544 RAPTOR_OPTION_NORMALIZE_LANGUAGE
,
545 RAPTOR_OPTION_NON_NFC_FATAL
,
546 RAPTOR_OPTION_WARN_OTHER_PARSETYPES
,
547 RAPTOR_OPTION_CHECK_RDF_ID
,
548 RAPTOR_OPTION_RELATIVE_URIS
,
549 RAPTOR_OPTION_WRITER_AUTO_INDENT
,
550 RAPTOR_OPTION_WRITER_AUTO_EMPTY
,
551 RAPTOR_OPTION_WRITER_INDENT_WIDTH
,
552 RAPTOR_OPTION_WRITER_XML_VERSION
,
553 RAPTOR_OPTION_WRITER_XML_DECLARATION
,
554 RAPTOR_OPTION_NO_NET
,
555 RAPTOR_OPTION_RESOURCE_BORDER
,
556 RAPTOR_OPTION_LITERAL_BORDER
,
557 RAPTOR_OPTION_BNODE_BORDER
,
558 RAPTOR_OPTION_RESOURCE_FILL
,
559 RAPTOR_OPTION_LITERAL_FILL
,
560 RAPTOR_OPTION_BNODE_FILL
,
561 RAPTOR_OPTION_HTML_TAG_SOUP
,
562 RAPTOR_OPTION_MICROFORMATS
,
563 RAPTOR_OPTION_HTML_LINK
,
564 RAPTOR_OPTION_WWW_TIMEOUT
,
565 RAPTOR_OPTION_WRITE_BASE_URI
,
566 RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL
,
567 RAPTOR_OPTION_WWW_HTTP_USER_AGENT
,
568 RAPTOR_OPTION_JSON_CALLBACK
,
569 RAPTOR_OPTION_JSON_EXTRA_DATA
,
570 RAPTOR_OPTION_RSS_TRIPLES
,
571 RAPTOR_OPTION_ATOM_ENTRY_URI
,
572 RAPTOR_OPTION_PREFIX_ELEMENTS
,
573 RAPTOR_OPTION_STRICT
,
574 RAPTOR_OPTION_WWW_CERT_FILENAME
,
575 RAPTOR_OPTION_WWW_CERT_TYPE
,
576 RAPTOR_OPTION_WWW_CERT_PASSPHRASE
,
577 RAPTOR_OPTION_NO_FILE
,
578 RAPTOR_OPTION_WWW_SSL_VERIFY_PEER
,
579 RAPTOR_OPTION_WWW_SSL_VERIFY_HOST
,
580 RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES
,
581 RAPTOR_OPTION_LAST
= RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES
586 * raptor_term_literal_value:
587 * @string: literal string
588 * @string_len: length of string
589 * @datatype: datatype URI (or NULL)
590 * @language: literal language (or NULL)
591 * @language_len: length of language
593 * Literal term value - this typedef exists solely for use in #raptor_term
595 * Either @datatype or @language may be non-NULL but not both.
598 unsigned char *string
;
599 unsigned int string_len
;
601 raptor_uri
*datatype
;
603 unsigned char *language
;
604 unsigned char language_len
;
605 } raptor_term_literal_value
;
609 * raptor_term_blank_value:
610 * @string: literal string
611 * @string_len: length of string
613 * Blank term value - this typedef exists solely for use in #raptor_term
617 unsigned char *string
;
618 unsigned int string_len
;
619 } raptor_term_blank_value
;
624 * @uri: uri value when term type is #RAPTOR_TERM_TYPE_URI
625 * @literal: literal value when term type is #RAPTOR_TERM_TYPE_LITERAL
626 * @blank: blank value when term type is #RAPTOR_TERM_TYPE_BLANK
628 * Term value - this typedef exists solely for use in #raptor_term
634 raptor_term_literal_value literal
;
636 raptor_term_blank_value blank
;
643 * @usage: usage reference count (if >0)
645 * @value: term values per type
647 * An RDF statement term
655 raptor_term_type type
;
657 raptor_term_value value
;
664 * @world: world pointer
665 * @usage: usage count
666 * @subject: statement subject
667 * @predicate: statement predicate
668 * @object: statement object
669 * @graph: statement graph name (or NULL if not present)
671 * An RDF triple with optional graph name (quad)
673 * See #raptor_term for a description of how the fields may be used.
674 * As returned by a parser statement_handler.
679 raptor_term
* subject
;
680 raptor_term
* predicate
;
688 * @RAPTOR_LOG_LEVEL_NONE: Internal
689 * @RAPTOR_LOG_LEVEL_TRACE: very fine-grained tracing messages information
690 * @RAPTOR_LOG_LEVEL_DEBUG: fine-grained tracing messages suitable for debugging
691 * @RAPTOR_LOG_LEVEL_INFO: coarse-grained information messages
692 * @RAPTOR_LOG_LEVEL_WARN: warning messages of potentially harmful problems
693 * @RAPTOR_LOG_LEVEL_ERROR: error messages where the application can continue
694 * @RAPTOR_LOG_LEVEL_FATAL: fatal error message where the application will likely abort
695 * @RAPTOR_LOG_LEVEL_LAST: Internal
700 RAPTOR_LOG_LEVEL_NONE
,
701 RAPTOR_LOG_LEVEL_TRACE
,
702 RAPTOR_LOG_LEVEL_DEBUG
,
703 RAPTOR_LOG_LEVEL_INFO
,
704 RAPTOR_LOG_LEVEL_WARN
,
705 RAPTOR_LOG_LEVEL_ERROR
,
706 RAPTOR_LOG_LEVEL_FATAL
,
707 RAPTOR_LOG_LEVEL_LAST
= RAPTOR_LOG_LEVEL_FATAL
713 * @RAPTOR_DOMAIN_IOSTREAM: I/O stream
714 * @RAPTOR_DOMAIN_NAMESPACE: XML Namespace / namespace stack
715 * @RAPTOR_DOMAIN_PARSER: RDF Parser
716 * @RAPTOR_DOMAIN_QNAME: XML QName
717 * @RAPTOR_DOMAIN_SAX2: XML SAX2
718 * @RAPTOR_DOMAIN_SERIALIZER: RDF Serializer
719 * @RAPTOR_DOMAIN_TERM: RDF Term
720 * @RAPTOR_DOMAIN_TURTLE_WRITER: Turtle Writer
721 * @RAPTOR_DOMAIN_URI: RDF Uri
722 * @RAPTOR_DOMAIN_WORLD: RDF world
723 * @RAPTOR_DOMAIN_WWW: WWW
724 * @RAPTOR_DOMAIN_XML_WRITER: XML Writer
725 * @RAPTOR_DOMAIN_NONE: Internal
726 * @RAPTOR_DOMAIN_LAST: Internal
732 RAPTOR_DOMAIN_IOSTREAM
,
733 RAPTOR_DOMAIN_NAMESPACE
,
734 RAPTOR_DOMAIN_PARSER
,
737 RAPTOR_DOMAIN_SERIALIZER
,
739 RAPTOR_DOMAIN_TURTLE_WRITER
,
743 RAPTOR_DOMAIN_XML_WRITER
,
744 RAPTOR_DOMAIN_LAST
= RAPTOR_DOMAIN_XML_WRITER
749 * raptor_log_message:
750 * @code: error code or < 0 if not used or known
751 * @domain: message domain or #RAPTOR_DOMAIN_NONE if not used or known
752 * @level: log message level
753 * @locator: location associated with message or NULL if not known
754 * @text: message string
760 raptor_domain domain
;
761 raptor_log_level level
;
762 raptor_locator
*locator
;
764 } raptor_log_message
;
768 * raptor_log_handler:
769 * @user_data: user data
770 * @message: log message
772 * Handler function for log messages with location
774 * Used during parsing and serializing for errors and warnings that
775 * may include location information. Handlers may be set
776 * by raptor_world_set_log_handler().
779 typedef void (*raptor_log_handler
)(void *user_data
, raptor_log_message
*message
);
783 * raptor_statement_handler:
784 * @user_data: user data
785 * @statement: statement to report
787 * Statement (triple) reporting handler function.
789 * This handler function set with
790 * raptor_parser_set_statement_handler() on a parser receives
791 * statements as the parsing proceeds. The @statement argument to the
792 * handler is shared and must be copied by the caller with
793 * raptor_statement_copy().
795 typedef void (*raptor_statement_handler
)(void *user_data
, raptor_statement
*statement
);
798 * raptor_graph_mark_flags:
799 * @RAPTOR_GRAPH_MARK_START: mark is start of graph (otherwise is end)
800 * @RAPTOR_GRAPH_MARK_DECLARED: mark was declared in syntax rather than implict
802 * Graph mark handler bitmask flags
805 RAPTOR_GRAPH_MARK_START
= 1,
806 RAPTOR_GRAPH_MARK_DECLARED
= 2
807 } raptor_graph_mark_flags
;
811 * raptor_graph_mark_handler:
812 * @user_data: user data
813 * @graph: graph to report, NULL for the default graph
814 * @flags: bitmask of #raptor_graph_mark_flags flags
816 * Graph start/end mark handler function.
818 * Records start and end of graphs happening in a stream of generated
819 * #raptor_statement via the statement handler. The callback starts a
820 * graph when @flags has #RAPTOR_GRAPH_MARK_START bit set.
822 * The start and ends may be either declared in the syntax via some
823 * keyword or mechanism such as TRiG {} syntax when @flags has bit
824 * #RAPTOR_GRAPH_MARK_DECLARED set, or be implied by the start/end of
825 * the data in other syntaxes, and the bit will be unset.
827 typedef void (*raptor_graph_mark_handler
)(void *user_data
, raptor_uri
*graph
, int flags
);
830 * raptor_generate_bnodeid_handler:
831 * @user_data: user data
832 * @user_bnodeid: a user-specified ID or NULL if none available.
834 * Generate a blank node identifier handler function.
836 * Return value: new blank node ID to use
838 typedef unsigned char* (*raptor_generate_bnodeid_handler
)(void *user_data
, unsigned char* user_bnodeid
);
841 * raptor_namespace_handler:
842 * @user_data: user data
843 * @nspace: #raptor_namespace declared
845 * XML Namespace declaration reporting handler set by
846 * raptor_parser_set_namespace_handler().
848 typedef void (*raptor_namespace_handler
)(void* user_data
, raptor_namespace
*nspace
);
852 * raptor_www_write_bytes_handler:
854 * @userdata: user data
856 * @size: size of individual item
857 * @nmemb: number of items
859 * Receiving bytes of data from WWW retrieval handler.
861 * Set by raptor_www_set_write_bytes_handler().
863 typedef void (*raptor_www_write_bytes_handler
)(raptor_www
* www
, void *userdata
, const void *ptr
, size_t size
, size_t nmemb
);
866 * raptor_www_content_type_handler:
868 * @userdata: user data
869 * @content_type: content type seen
871 * Receiving Content-Type: header from WWW retrieval handler.
873 * Set by raptor_www_set_content_type_handler().
875 typedef void (*raptor_www_content_type_handler
)(raptor_www
* www
, void *userdata
, const char *content_type
);
878 * raptor_www_final_uri_handler:
880 * @userdata: user data
881 * @final_uri: final URI seen
883 * Receiving the final resolved URI from a WWW retrieval
885 * Set by raptor_www_set_final_uri_handler().
887 typedef void (*raptor_www_final_uri_handler
)(raptor_www
* www
, void *userdata
, raptor_uri
*final_uri
);
890 * raptor_uri_filter_func:
891 * @user_data: user data
892 * @uri: #raptor_uri URI to check
894 * Callback function for #raptor_www_set_uri_filter
896 * Return value: non-0 to filter the URI
898 typedef int (*raptor_uri_filter_func
)(void *user_data
, raptor_uri
* uri
);
903 * @RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE: if set (non-0 value) - save/restore the libxml generic error handler when raptor library initializes (default set)
904 * @RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE: if set (non-0 value) - save/restore the libxml structured error handler when raptor library terminates (default set)
905 * @RAPTOR_WORLD_FLAG_URI_INTERNING: if set (non-0 value) - each URI is saved interned in-memory and reused (default set)
906 * @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 and 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 does mean that applications which use this call must do their own extra work in order to allocate and free all resources to the system.
910 * These are used by raptor_world_set_flags() to control raptor-wide
911 * options across classes. These must be set before
912 * raptor_world_open() is called explicitly or implicitly (by
913 * creating a raptor object). There is no enumeration function for
914 * these flags because they are not user options and must be set
915 * before the library is initialised. For similar reasons, there is
918 * If any libxml handler saving/restoring is enabled, any existing
919 * handler and context is saved before parsing and restored
920 * afterwards. Otherwise, no saving/restoring is performed.
924 RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE
= 1,
925 RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE
= 2,
926 RAPTOR_WORLD_FLAG_URI_INTERNING
= 3,
927 RAPTOR_WORLD_FLAG_WWW_SKIP_INIT_FINISH
= 4
932 * raptor_data_compare_handler:
933 * @data1: first data object
934 * @data2: second data object
936 * Function to compare two data objects - signature like strcmp() and function pssed to qsort()
938 * Designed to be passed into generic data structure constructors
939 * like raptor_new_avltree().
941 * Return value: compare value <0 if @data1 is before @data2, =0 if equal, >0 if @data1 is after @data2
943 typedef int (*raptor_data_compare_handler
)(const void* data1
, const void* data2
);
947 * raptor_data_malloc_handler:
950 * Typedef for a function to allocate memory - signature like malloc()
952 * Designed to be passed into constructors
953 * like raptor_www_fetch_to_string
955 * Return value: pointer to newly allocated memory or NULL on failure
957 typedef void* (*raptor_data_malloc_handler
)(size_t size
);
961 * raptor_data_free_handler:
962 * @data: data object or NULL
964 * Typedef for function to free a data object - signature like free()
966 * Designed to be passed into generic data structure constructors
967 * like raptor_new_avltree(). If @data is NULL, nothing should be done.
969 typedef void (*raptor_data_free_handler
)(void* data
);
973 * raptor_data_context_free_handler:
974 * @context: context data for the free function
975 * @object: object to free
977 * Handler function for freeing a sequence item with a contextual pointer.
979 * Set by raptor_new_sequence_with_context().
981 typedef void (*raptor_data_context_free_handler
)(void* context
, void* object
);
984 * raptor_data_print_handler:
985 * @object: object to print
986 * @fh: FILE* to print to
988 * Handler function for printing an object to a stream.
990 * Set by raptor_new_sequence()
992 * Return value: non-0 on failure
994 typedef int (*raptor_data_print_handler
)(void *object
, FILE *fh
);
997 * raptor_data_context_print_handler:
998 * @context: context data for the print function
999 * @object: object to print
1000 * @fh: FILE* to print to
1002 * Function function for printing an object with data context to a stream.
1004 * Set by raptor_new_sequence_with_context()
1006 * Return value: non-0 on failure
1008 typedef int (*raptor_data_context_print_handler
)(void *context
, void *object
, FILE *fh
);
1011 * raptor_stringbuffer:
1013 * Raptor string buffer class
1015 typedef struct raptor_stringbuffer_s raptor_stringbuffer
;
1018 /* Public functions */
1020 #define raptor_new_world() raptor_new_world_internal(RAPTOR_VERSION)
1021 /* The real target of the raptor_new_world() macro */
1023 raptor_world
*raptor_new_world_internal(unsigned int version_decimal
);
1025 int raptor_world_open(raptor_world
* world
);
1027 void raptor_free_world(raptor_world
* world
);
1029 int raptor_world_set_libxslt_security_preferences(raptor_world
*world
, void *security_preferences
);
1031 int raptor_world_set_flag(raptor_world
*world
, raptor_world_flag flag
, int value
);
1033 int raptor_world_set_log_handler(raptor_world
*world
, void *user_data
, raptor_log_handler handler
);
1035 void raptor_world_set_generate_bnodeid_handler(raptor_world
* world
, void *user_data
, raptor_generate_bnodeid_handler handler
);
1037 unsigned char* raptor_world_generate_bnodeid(raptor_world
*world
);
1039 void raptor_world_set_generate_bnodeid_parameters(raptor_world
* world
, char *prefix
, int base
);
1041 const char* raptor_log_level_get_label(raptor_log_level level
);
1043 const char* raptor_domain_get_label(raptor_domain domain
);
1047 int raptor_world_is_parser_name(raptor_world
* world
, const char *name
);
1049 const char* raptor_world_guess_parser_name(raptor_world
* world
, raptor_uri
*uri
, const char *mime_type
, const unsigned char *buffer
, size_t len
, const unsigned char *identifier
);
1051 int raptor_world_is_serializer_name(raptor_world
* world
, const char *name
);
1053 /* Syntax descriptions */
1055 const raptor_syntax_description
* raptor_world_get_parser_description(raptor_world
* world
, unsigned int counter
);
1057 const raptor_syntax_description
* raptor_world_get_serializer_description(raptor_world
* world
, unsigned int counter
);
1059 int raptor_syntax_description_validate(raptor_syntax_description
* desc
);
1062 raptor_option
raptor_world_get_option_from_uri(raptor_world
* world
, raptor_uri
*uri
);
1067 raptor_term
* raptor_new_term_from_uri(raptor_world
* world
, raptor_uri
* uri
);
1069 raptor_term
* raptor_new_term_from_counted_uri_string(raptor_world
* world
, const unsigned char *uri_string
, size_t length
);
1071 raptor_term
* raptor_new_term_from_uri_string(raptor_world
* world
, const unsigned char *uri_string
);
1073 raptor_term
* raptor_new_term_from_literal(raptor_world
* world
, const unsigned char* literal
, raptor_uri
* datatype
, const unsigned char* language
);
1075 raptor_term
* raptor_new_term_from_counted_literal(raptor_world
* world
, const unsigned char* literal
, size_t literal_len
, raptor_uri
* datatype
, const unsigned char* language
, unsigned char language_len
);
1077 raptor_term
* raptor_new_term_from_blank(raptor_world
* world
, const unsigned char* blank
);
1079 raptor_term
* raptor_new_term_from_counted_blank(raptor_world
* world
, const unsigned char* blank
, size_t length
);
1081 raptor_term
* raptor_term_copy(raptor_term
* term
);
1083 int raptor_term_compare(const raptor_term
*t1
, const raptor_term
*t2
);
1085 int raptor_term_equals(raptor_term
* t1
, raptor_term
* t2
);
1087 void raptor_free_term(raptor_term
*term
);
1090 unsigned char* raptor_term_to_counted_string(raptor_term
*term
, size_t* len_p
);
1092 unsigned char* raptor_term_to_string(raptor_term
*term
);
1094 int raptor_term_ntriples_write(const raptor_term
*term
, raptor_iostream
* iostr
);
1096 int raptor_uri_turtle_write(raptor_world
*world
, raptor_iostream
* iostr
, raptor_uri
* uri
, raptor_namespace_stack
*nstack
, raptor_uri
*base_uri
);
1098 int raptor_term_turtle_write(raptor_iostream
* iostr
, raptor_term
* term
, raptor_namespace_stack
*nstack
, raptor_uri
*base_uri
);
1100 unsigned char* raptor_uri_to_turtle_counted_string(raptor_world
*world
, raptor_uri
* uri
, raptor_namespace_stack
*nstack
, raptor_uri
*base_uri
, size_t *len_p
);
1102 unsigned char* raptor_uri_to_turtle_string(raptor_world
*world
, raptor_uri
* uri
, raptor_namespace_stack
*nstack
, raptor_uri
*base_uri
);
1104 unsigned char* raptor_term_to_turtle_counted_string(raptor_term
* term
, raptor_namespace_stack
*nstack
, raptor_uri
*base_uri
, size_t *len_p
);
1106 unsigned char* raptor_term_to_turtle_string(raptor_term
* term
, raptor_namespace_stack
*nstack
, raptor_uri
*base_uri
);
1109 /* Statement Class */
1111 void raptor_statement_init(raptor_statement
*statement
, raptor_world
*world
);
1113 void raptor_statement_clear(raptor_statement
*statement
);
1115 raptor_statement
* raptor_new_statement(raptor_world
*world
);
1117 raptor_statement
* raptor_new_statement_from_nodes(raptor_world
* world
, raptor_term
*subject
, raptor_term
*predicate
, raptor_term
*object
, raptor_term
*graph
);
1119 raptor_statement
* raptor_statement_copy(raptor_statement
*statement
);
1121 void raptor_free_statement(raptor_statement
*statement
);
1124 int raptor_statement_print(const raptor_statement
* statement
, FILE *stream
);
1126 int raptor_statement_print_as_ntriples(const raptor_statement
* statement
, FILE *stream
);
1128 int raptor_statement_compare(const raptor_statement
*s1
, const raptor_statement
*s2
);
1130 int raptor_statement_equals(const raptor_statement
* s1
, const raptor_statement
* s2
);
1135 raptor_parser
* raptor_new_parser(raptor_world
* world
, const char *name
);
1137 raptor_parser
* raptor_new_parser_for_content(raptor_world
* world
, raptor_uri
*uri
, const char *mime_type
, const unsigned char *buffer
, size_t len
, const unsigned char *identifier
);
1139 void raptor_free_parser(raptor_parser
* parser
);
1145 void raptor_parser_set_statement_handler(raptor_parser
* parser
, void *user_data
, raptor_statement_handler handler
);
1147 void raptor_parser_set_graph_mark_handler(raptor_parser
* parser
, void *user_data
, raptor_graph_mark_handler handler
);
1149 void raptor_parser_set_namespace_handler(raptor_parser
* parser
, void *user_data
, raptor_namespace_handler handler
);
1151 void raptor_parser_set_uri_filter(raptor_parser
* parser
, raptor_uri_filter_func filter
, void* user_data
);
1153 raptor_locator
* raptor_parser_get_locator(raptor_parser
* rdf_parser
);
1156 /* Parsing functions */
1158 int raptor_parser_parse_start(raptor_parser
*rdf_parser
, raptor_uri
*uri
);
1160 int raptor_parser_parse_chunk(raptor_parser
* rdf_parser
, const unsigned char *buffer
, size_t len
, int is_end
);
1162 int raptor_parser_parse_file_stream(raptor_parser
* rdf_parser
, FILE *stream
, const char *filename
, raptor_uri
*base_uri
);
1164 int raptor_parser_parse_file(raptor_parser
* rdf_parser
, raptor_uri
*uri
, raptor_uri
*base_uri
);
1166 int raptor_parser_parse_uri(raptor_parser
* rdf_parser
, raptor_uri
*uri
, raptor_uri
*base_uri
);
1168 int raptor_parser_parse_uri_with_connection(raptor_parser
* rdf_parser
, raptor_uri
*uri
, raptor_uri
*base_uri
, void *connection
);
1170 int raptor_parser_parse_iostream(raptor_parser
* rdf_parser
, raptor_iostream
*iostr
, raptor_uri
*base_uri
);
1172 void raptor_parser_parse_abort(raptor_parser
* rdf_parser
);
1174 const char* raptor_parser_get_name(raptor_parser
*rdf_parser
);
1176 const raptor_syntax_description
* raptor_parser_get_description(raptor_parser
*rdf_parser
);
1178 /* parser option methods */
1180 int raptor_parser_set_option(raptor_parser
*parser
, raptor_option option
, const char* string
, int integer
);
1182 int raptor_parser_get_option(raptor_parser
*parser
, raptor_option option
, char** string_p
, int* integer_p
);
1184 /* parser utility methods */
1186 const char* raptor_parser_get_accept_header(raptor_parser
* rdf_parser
);
1188 raptor_world
* raptor_parser_get_world(raptor_parser
* rdf_parser
);
1190 raptor_uri
* raptor_parser_get_graph(raptor_parser
* rdf_parser
);
1196 int raptor_locator_print(raptor_locator
* locator
, FILE *stream
);
1198 int raptor_locator_format(char *buffer
, size_t length
, raptor_locator
* locator
);
1200 int raptor_locator_line(raptor_locator
*locator
);
1202 int raptor_locator_column(raptor_locator
*locator
);
1204 int raptor_locator_byte(raptor_locator
*locator
);
1206 const char* raptor_locator_file(raptor_locator
*locator
);
1208 const char* raptor_locator_uri(raptor_locator
*locator
);
1211 /* Serializer Class */
1213 raptor_serializer
* raptor_new_serializer(raptor_world
* world
, const char *name
);
1215 void raptor_free_serializer(raptor_serializer
* rdf_serializer
);
1219 int raptor_serializer_start_to_iostream(raptor_serializer
*rdf_serializer
, raptor_uri
*uri
, raptor_iostream
*iostream
);
1221 int raptor_serializer_start_to_filename(raptor_serializer
*rdf_serializer
, const char *filename
);
1223 int raptor_serializer_start_to_string(raptor_serializer
*rdf_serializer
, raptor_uri
*uri
, void **string_p
, size_t *length_p
);
1225 int raptor_serializer_start_to_file_handle(raptor_serializer
*rdf_serializer
, raptor_uri
*uri
, FILE *fh
);
1227 int raptor_serializer_set_namespace(raptor_serializer
* rdf_serializer
, raptor_uri
*uri
, const unsigned char *prefix
);
1229 int raptor_serializer_set_namespace_from_namespace(raptor_serializer
* rdf_serializer
, raptor_namespace
*nspace
);
1231 int raptor_serializer_serialize_statement(raptor_serializer
* rdf_serializer
, raptor_statement
*statement
);
1233 int raptor_serializer_serialize_end(raptor_serializer
*rdf_serializer
);
1235 raptor_iostream
* raptor_serializer_get_iostream(raptor_serializer
*serializer
);
1237 raptor_locator
* raptor_serializer_get_locator(raptor_serializer
*rdf_serializer
);
1239 int raptor_serializer_flush(raptor_serializer
*rdf_serializer
);
1241 const raptor_syntax_description
* raptor_serializer_get_description(raptor_serializer
*rdf_serializer
);
1243 /* serializer option methods */
1245 int raptor_serializer_set_option(raptor_serializer
*serializer
, raptor_option option
, const char* string
, int integer
);
1247 int raptor_serializer_get_option(raptor_serializer
*serializer
, raptor_option option
, char** string_p
, int* integer_p
);
1249 /* utility methods */
1251 raptor_world
* raptor_serializer_get_world(raptor_serializer
* rdf_serializer
);
1254 /* memory functions */
1256 void raptor_free_memory(void *ptr
);
1258 void* raptor_alloc_memory(size_t size
);
1260 void* raptor_calloc_memory(size_t nmemb
, size_t size
);
1265 raptor_uri
* raptor_new_uri_from_counted_string(raptor_world
* world
, const unsigned char *uri_string
, size_t length
);
1267 raptor_uri
* raptor_new_uri(raptor_world
* world
, const unsigned char *uri_string
);
1269 raptor_uri
* raptor_new_uri_from_uri_local_name(raptor_world
* world
, raptor_uri
*uri
, const unsigned char *local_name
);
1271 raptor_uri
* raptor_new_uri_relative_to_base(raptor_world
* world
, raptor_uri
*base_uri
, const unsigned char *uri_string
);
1273 raptor_uri
* raptor_new_uri_relative_to_base_counted(raptor_world
* world
, raptor_uri
*base_uri
, const unsigned char *uri_string
, size_t uri_len
);
1275 raptor_uri
* raptor_new_uri_from_id(raptor_world
* world
, raptor_uri
*base_uri
, const unsigned char *id
);
1277 raptor_uri
* raptor_new_uri_from_uri_or_file_string(raptor_world
* world
, raptor_uri
* base_uri
, const unsigned char* uri_or_file_string
);
1279 raptor_uri
* raptor_new_uri_for_rdf_concept(raptor_world
* world
, const unsigned char *name
);
1281 raptor_uri
* raptor_new_uri_for_xmlbase(raptor_uri
* old_uri
);
1283 raptor_uri
* raptor_new_uri_for_retrieval(raptor_uri
* old_uri
);
1285 void raptor_free_uri(raptor_uri
*uri
);
1289 int raptor_uri_equals(raptor_uri
* uri1
, raptor_uri
* uri2
);
1291 int raptor_uri_compare(raptor_uri
* uri1
, raptor_uri
* uri2
);
1293 raptor_uri
* raptor_uri_copy(raptor_uri
*uri
);
1295 unsigned char* raptor_uri_as_string(raptor_uri
*uri
);
1297 unsigned char* raptor_uri_as_counted_string(raptor_uri
*uri
, size_t* len_p
);
1299 unsigned char* raptor_uri_to_relative_counted_uri_string(raptor_uri
*base_uri
, raptor_uri
*reference_uri
, size_t *length_p
);
1301 unsigned char* raptor_uri_to_relative_uri_string(raptor_uri
*base_uri
, raptor_uri
*reference_uri
);
1303 int raptor_uri_print(const raptor_uri
* uri
, FILE *stream
);
1305 unsigned char* raptor_uri_to_counted_string(raptor_uri
*uri
, size_t *len_p
);
1307 unsigned char* raptor_uri_to_string(raptor_uri
*uri
);
1309 raptor_world
* raptor_uri_get_world(raptor_uri
*uri
);
1311 int raptor_uri_file_exists(raptor_uri
* uri
);
1313 /* XML utility functions */
1315 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 xml_version
);
1317 int raptor_xml_escape_string_any_write(const unsigned char *string
, size_t len
, char quote
, int xml_version
, raptor_iostream
* iostr
);
1319 int raptor_xml_escape_string(raptor_world
*world
, const unsigned char *string
, size_t len
, unsigned char *buffer
, size_t length
, char quote
);
1321 int raptor_xml_escape_string_write(const unsigned char *string
, size_t len
, char quote
, raptor_iostream
* iostr
);
1323 int raptor_xml_name_check(const unsigned char *string
, size_t length
, int xml_version
);
1326 /* portable vsnprintf utility function */
1327 RAPTOR_API RAPTOR_DEPRECATED
1328 char* raptor_vsnprintf(const char *format
, va_list arguments
) RAPTOR_PRINTF_FORMAT(1, 0);
1330 int raptor_vsnprintf2(char *buffer
, size_t size
, const char *format
, va_list arguments
) RAPTOR_PRINTF_FORMAT(3, 0);
1332 int raptor_snprintf(char *buffer
, size_t size
, const char *format
, ...) RAPTOR_PRINTF_FORMAT(3, 4);
1334 int raptor_vasprintf(char **ret
, const char *format
, va_list arguments
) RAPTOR_PRINTF_FORMAT(2, 0);
1336 /* RFC2396 URI resolving functions */
1338 size_t raptor_uri_resolve_uri_reference(const unsigned char *base_uri
, const unsigned char *reference_uri
, unsigned char* buffer
, size_t length
);
1340 /* URI String utility functions */
1342 unsigned char* raptor_uri_filename_to_uri_string(const char *filename
);
1344 int raptor_uri_filename_exists(const unsigned char* path
);
1346 char* raptor_uri_uri_string_to_filename(const unsigned char *uri_string
);
1348 char* raptor_uri_uri_string_to_filename_fragment(const unsigned char *uri_string
, unsigned char **fragment_p
);
1350 int raptor_uri_uri_string_is_file_uri(const unsigned char* uri_string
);
1352 int raptor_stringbuffer_append_uri_escaped_counted_string(raptor_stringbuffer
* sb
, const char* string
, size_t length
, int space_is_plus
);
1354 char* raptor_uri_uri_string_to_counted_filename_fragment(const unsigned char *uri_string
, size_t* len_p
, unsigned char **fragment_p
, size_t* fragment_len_p
);
1358 * RAPTOR_RDF_MS_URI:
1360 * RDF Namespace URI (rdf:).
1362 * Copy with raptor_uri_copy() to use.
1364 #define RAPTOR_RDF_MS_URI raptor_rdf_namespace_uri
1367 * RAPTOR_RDF_SCHEMA_URI:
1369 * RDF Schema Namespace URI (rdfs:).
1371 * Copy with raptor_uri_copy() to use.
1373 #define RAPTOR_RDF_SCHEMA_URI raptor_rdf_schema_namespace_uri
1376 * RAPTOR_XMLSCHEMA_DATATYPES_URI:
1378 * XML Schema Datatypes URI (xsd:).
1380 * Copy with raptor_uri_copy() to use.
1382 #define RAPTOR_XMLSCHEMA_DATATYPES_URI raptor_xmlschema_datatypes_namespace_uri
1387 * OWL Namespace URI (owl:).
1389 * Copy with raptor_uri_copy() to use.
1391 #define RAPTOR_OWL_URI raptor_owl_namespace_uri
1396 raptor_www
* raptor_new_www(raptor_world
* world
);
1398 raptor_www
* raptor_new_www_with_connection(raptor_world
* world
, void* connection
);
1400 void raptor_free_www(raptor_www
*www
);
1402 int raptor_www_set_ssl_cert_options(raptor_www
* www
, const char* cert_filename
, const char* cert_type
, const char* cert_passphrase
);
1404 int raptor_www_set_ssl_verify_options(raptor_www
* www
, int verify_peer
, int verify_host
);
1406 void raptor_www_set_user_agent(raptor_www
*www
, const char *user_agent
);
1408 void raptor_www_set_proxy(raptor_www
*www
, const char *proxy
);
1410 void raptor_www_set_http_accept(raptor_www
*www
, const char *value
);
1412 void raptor_www_set_write_bytes_handler(raptor_www
*www
, raptor_www_write_bytes_handler handler
, void *user_data
);
1414 void raptor_www_set_content_type_handler(raptor_www
*www
, raptor_www_content_type_handler handler
, void *user_data
);
1416 void raptor_www_set_final_uri_handler(raptor_www
* www
, raptor_www_final_uri_handler handler
, void *user_data
);
1418 void raptor_www_set_uri_filter(raptor_www
* www
, raptor_uri_filter_func filter
, void* user_data
);
1420 void raptor_www_set_connection_timeout(raptor_www
* www
, int timeout
);
1422 int raptor_www_set_http_cache_control(raptor_www
* www
, const char* cache_control
);
1424 int raptor_www_fetch(raptor_www
*www
, raptor_uri
*uri
);
1426 int raptor_www_fetch_to_string(raptor_www
*www
, raptor_uri
*uri
, void **string_p
, size_t *length_p
, raptor_data_malloc_handler
const malloc_handler
);
1428 void* raptor_www_get_connection(raptor_www
*www
);
1430 void raptor_www_abort(raptor_www
*www
, const char *reason
);
1432 raptor_uri
* raptor_www_get_final_uri(raptor_www
* www
);
1435 /* XML QNames Class */
1437 raptor_qname
* raptor_new_qname(raptor_namespace_stack
*nstack
, const unsigned char *name
, const unsigned char *value
);
1439 raptor_qname
* raptor_new_qname_from_namespace_local_name(raptor_world
* world
, raptor_namespace
*ns
, const unsigned char *local_name
, const unsigned char *value
);
1443 raptor_qname
* raptor_qname_copy(raptor_qname
*qname
);
1445 void raptor_free_qname(raptor_qname
* name
);
1447 int raptor_qname_equal(raptor_qname
*name1
, raptor_qname
*name2
);
1449 unsigned char* raptor_qname_to_counted_name(raptor_qname
*qname
, size_t* length_p
);
1451 const raptor_namespace
* raptor_qname_get_namespace(raptor_qname
* name
);
1453 const unsigned char* raptor_qname_get_local_name(raptor_qname
* name
);
1455 const unsigned char* raptor_qname_get_value(raptor_qname
* name
);
1457 const unsigned char* raptor_qname_get_counted_value(raptor_qname
* name
, size_t* length_p
);
1459 int raptor_qname_write(raptor_qname
*qname
, raptor_iostream
* iostr
);
1461 /* QName String utility functions */
1463 raptor_uri
* raptor_qname_string_to_uri(raptor_namespace_stack
*nstack
, const unsigned char *name
, size_t name_len
);
1465 /* XML Namespaces Stack class */
1467 raptor_namespace
* raptor_new_namespace_from_uri(raptor_namespace_stack
*nstack
, const unsigned char *prefix
, raptor_uri
* ns_uri
, int depth
);
1469 raptor_namespace_stack
* raptor_new_namespaces(raptor_world
* world
, int defaults
);
1471 int raptor_namespaces_init(raptor_world
* world
, raptor_namespace_stack
*nstack
, int defaults
);
1473 void raptor_namespaces_clear(raptor_namespace_stack
*nstack
);
1475 void raptor_free_namespaces(raptor_namespace_stack
*nstack
);
1479 void raptor_namespaces_start_namespace(raptor_namespace_stack
*nstack
, raptor_namespace
*nspace
);
1481 int raptor_namespaces_start_namespace_full(raptor_namespace_stack
*nstack
, const unsigned char *prefix
, const unsigned char *ns_uri_string
, int depth
);
1483 void raptor_namespaces_end_for_depth(raptor_namespace_stack
*nstack
, int depth
);
1485 raptor_namespace
* raptor_namespaces_get_default_namespace(raptor_namespace_stack
*nstack
);
1487 raptor_namespace
* raptor_namespaces_find_namespace(raptor_namespace_stack
*nstack
, const unsigned char *prefix
, int prefix_length
);
1489 raptor_namespace
* raptor_namespaces_find_namespace_by_uri(raptor_namespace_stack
*nstack
, raptor_uri
*ns_uri
);
1491 int raptor_namespaces_namespace_in_scope(raptor_namespace_stack
*nstack
, const raptor_namespace
*nspace
);
1493 raptor_qname
* raptor_new_qname_from_namespace_uri(raptor_namespace_stack
*nstack
, raptor_uri
*uri
, int xml_version
);
1496 /* XML Namespace Class */
1498 raptor_namespace
* raptor_new_namespace(raptor_namespace_stack
*nstack
, const unsigned char *prefix
, const unsigned char *ns_uri_string
, int depth
);
1500 void raptor_free_namespace(raptor_namespace
*ns
);
1502 int raptor_namespace_stack_start_namespace(raptor_namespace_stack
*nstack
, raptor_namespace
*ns
, int new_depth
);
1504 raptor_uri
* raptor_namespace_get_uri(const raptor_namespace
*ns
);
1506 const unsigned char* raptor_namespace_get_prefix(const raptor_namespace
*ns
);
1508 const unsigned char* raptor_namespace_get_counted_prefix(const raptor_namespace
*ns
, size_t *length_p
);
1510 unsigned char* raptor_namespace_format_as_xml(const raptor_namespace
*ns
, size_t *length_p
);
1512 int raptor_namespace_write(raptor_namespace
*ns
, raptor_iostream
* iostr
);
1514 /* namespace string utility function */
1516 int raptor_xml_namespace_string_parse(const unsigned char *string
, unsigned char **prefix
, unsigned char **uri_string
);
1518 /* Sequence class */
1522 * Raptor sequence class
1524 typedef struct raptor_sequence_s raptor_sequence
;
1526 /* Sequence Class */
1528 raptor_sequence
* raptor_new_sequence(raptor_data_free_handler free_handler
, raptor_data_print_handler print_handler
);
1530 raptor_sequence
* raptor_new_sequence_with_context(raptor_data_context_free_handler free_handler
, raptor_data_context_print_handler print_handler
, void* handler_context
);
1532 void raptor_free_sequence(raptor_sequence
* seq
);
1536 int raptor_sequence_size(raptor_sequence
* seq
);
1538 int raptor_sequence_set_at(raptor_sequence
* seq
, int idx
, void *data
);
1540 int raptor_sequence_push(raptor_sequence
* seq
, void *data
);
1542 int raptor_sequence_shift(raptor_sequence
* seq
, void *data
);
1544 void* raptor_sequence_get_at(raptor_sequence
* seq
, int idx
);
1546 void* raptor_sequence_pop(raptor_sequence
* seq
);
1548 void* raptor_sequence_unshift(raptor_sequence
* seq
);
1550 void* raptor_sequence_delete_at(raptor_sequence
* seq
, int idx
);
1553 void raptor_sequence_sort(raptor_sequence
* seq
, raptor_data_compare_handler compare
);
1555 int raptor_sequence_swap(raptor_sequence
* seq
, int i
, int j
);
1557 int raptor_sequence_reverse(raptor_sequence
* seq
, int start_index
, int length
);
1559 int raptor_sequence_next_permutation(raptor_sequence
*seq
, raptor_data_compare_handler compare
);
1561 /* helper for printing sequences of strings */
1563 int raptor_sequence_print(raptor_sequence
* seq
, FILE* fh
);
1565 int raptor_sequence_join(raptor_sequence
* dest
, raptor_sequence
*src
);
1568 /* Unicode and UTF8 */
1573 * raptor Unicode codepoint
1575 typedef unsigned long raptor_unichar
;
1577 int raptor_unicode_utf8_string_put_char(raptor_unichar c
, unsigned char *output
, size_t length
);
1579 int raptor_unicode_utf8_string_get_char(const unsigned char *input
, size_t length
, raptor_unichar
*output
);
1581 int raptor_unicode_is_xml11_namestartchar(raptor_unichar c
);
1583 int raptor_unicode_is_xml10_namestartchar(raptor_unichar c
);
1585 int raptor_unicode_is_xml11_namechar(raptor_unichar c
);
1587 int raptor_unicode_is_xml10_namechar(raptor_unichar c
);
1589 int raptor_unicode_check_utf8_string(const unsigned char *string
, size_t length
);
1591 int raptor_unicode_utf8_strlen(const unsigned char *string
, size_t length
);
1593 size_t raptor_unicode_utf8_substr(unsigned char* dest
, size_t* dest_length_p
, const unsigned char* src
, size_t src_length
, int startingLoc
, int length
);
1595 /* Stringbuffer Class */
1597 raptor_stringbuffer
* raptor_new_stringbuffer(void);
1599 void raptor_free_stringbuffer(raptor_stringbuffer
*stringbuffer
);
1603 int raptor_stringbuffer_append_counted_string(raptor_stringbuffer
* stringbuffer
, const unsigned char *string
, size_t length
, int do_copy
);
1605 int raptor_stringbuffer_append_string(raptor_stringbuffer
* stringbuffer
, const unsigned char *string
, int do_copy
);
1607 int raptor_stringbuffer_append_decimal(raptor_stringbuffer
* stringbuffer
, int integer
);
1609 int raptor_stringbuffer_append_hexadecimal(raptor_stringbuffer
* stringbuffer
, int hex
);
1611 int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer
* stringbuffer
, raptor_stringbuffer
* append
);
1613 int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer
* stringbuffer
, const unsigned char *string
, size_t length
, int do_copy
);
1615 int raptor_stringbuffer_prepend_string(raptor_stringbuffer
* stringbuffer
, const unsigned char *string
, int do_copy
);
1617 unsigned char* raptor_stringbuffer_as_string(raptor_stringbuffer
* stringbuffer
);
1619 size_t raptor_stringbuffer_length(raptor_stringbuffer
* stringbuffer
);
1621 int raptor_stringbuffer_copy_to_string(raptor_stringbuffer
* stringbuffer
, unsigned char *string
, size_t length
);
1624 * raptor_iostream_init_func:
1625 * @context: stream context data
1627 * Handler function for #raptor_iostream initialising.
1629 * Return value: non-0 on failure.
1631 typedef int (*raptor_iostream_init_func
) (void *context
);
1634 * raptor_iostream_finish_func:
1635 * @context: stream context data
1637 * Handler function for #raptor_iostream terminating.
1640 typedef void (*raptor_iostream_finish_func
) (void *context
);
1643 * raptor_iostream_write_byte_func
1644 * @context: stream context data
1645 * @byte: byte to write
1647 * Handler function for implementing raptor_iostream_write_byte().
1649 * Return value: non-0 on failure.
1651 typedef int (*raptor_iostream_write_byte_func
) (void *context
, const int byte
);
1654 * raptor_iostream_write_bytes_func:
1655 * @context: stream context data
1656 * @ptr: pointer to bytes to write
1657 * @size: size of item
1658 * @nmemb: number of items
1660 * Handler function for implementing raptor_iostream_write_bytes().
1662 * Return value: non-0 on failure.
1664 typedef int (*raptor_iostream_write_bytes_func
) (void *context
, const void *ptr
, size_t size
, size_t nmemb
);
1667 * raptor_iostream_write_end_func:
1668 * @context: stream context data
1670 * Handler function for implementing raptor_iostream_write_end().
1672 * Return value: non-0 on failure.
1674 typedef int (*raptor_iostream_write_end_func
) (void *context
);
1677 * raptor_iostream_read_bytes_func:
1678 * @context: stream context data
1679 * @ptr: pointer to buffer to read into
1680 * @size: size of buffer
1681 * @nmemb: number of items
1683 * Handler function for implementing raptor_iostream_read_bytes().
1685 * Return value: number of items read, 0 or < @size on EOF, <0 on failure
1687 typedef int (*raptor_iostream_read_bytes_func
) (void *context
, void *ptr
, size_t size
, size_t nmemb
);
1690 * raptor_iostream_read_eof_func:
1691 * @context: stream context data
1693 * Handler function for implementing raptor_iostream_read_eof().
1695 * Return value: non-0 if EOF
1697 typedef int (*raptor_iostream_read_eof_func
) (void *context
);
1700 * raptor_iostream_handler:
1701 * @version: interface version. Presently 1 or 2.
1702 * @init: initialisation handler - optional, called at most once (V1)
1703 * @finish: finishing handler - optional, called at most once (V1)
1704 * @write_byte: write byte handler - required (for writing) (V1)
1705 * @write_bytes: write bytes handler - required (for writing) (V1)
1706 * @write_end: write end handler - optional (for writing), called at most once (V1)
1707 * @read_bytes: read bytes handler - required (for reading) (V2)
1708 * @read_eof: read EOF handler - required (for reading) (V2)
1710 * I/O stream implementation handler structure.
1717 raptor_iostream_init_func init
;
1718 raptor_iostream_finish_func finish
;
1719 raptor_iostream_write_byte_func write_byte
;
1720 raptor_iostream_write_bytes_func write_bytes
;
1721 raptor_iostream_write_end_func write_end
;
1724 raptor_iostream_read_bytes_func read_bytes
;
1725 raptor_iostream_read_eof_func read_eof
;
1726 } raptor_iostream_handler
;
1729 /* I/O Stream Class */
1731 raptor_iostream
* raptor_new_iostream_from_handler(raptor_world
* world
, void *user_data
, const raptor_iostream_handler
* const handler
);
1733 raptor_iostream
* raptor_new_iostream_to_sink(raptor_world
* world
);
1735 raptor_iostream
* raptor_new_iostream_to_filename(raptor_world
* world
, const char *filename
);
1737 raptor_iostream
* raptor_new_iostream_to_file_handle(raptor_world
* world
, FILE *handle
);
1739 raptor_iostream
* raptor_new_iostream_to_string(raptor_world
* world
, void **string_p
, size_t *length_p
, raptor_data_malloc_handler
const malloc_handler
);
1741 raptor_iostream
* raptor_new_iostream_from_sink(raptor_world
* world
);
1743 raptor_iostream
* raptor_new_iostream_from_filename(raptor_world
* world
, const char *filename
);
1745 raptor_iostream
* raptor_new_iostream_from_file_handle(raptor_world
* world
, FILE *handle
);
1747 raptor_iostream
* raptor_new_iostream_from_string(raptor_world
* world
, void *string
, size_t length
);
1749 void raptor_free_iostream(raptor_iostream
*iostr
);
1752 int raptor_iostream_write_bytes(const void *ptr
, size_t size
, size_t nmemb
, raptor_iostream
*iostr
);
1754 int raptor_iostream_write_byte(const int byte
, raptor_iostream
*iostr
);
1756 int raptor_iostream_write_end(raptor_iostream
*iostr
);
1758 int raptor_iostream_string_write(const void *string
, raptor_iostream
*iostr
);
1760 int raptor_iostream_counted_string_write(const void *string
, size_t len
, raptor_iostream
*iostr
);
1762 unsigned long raptor_iostream_tell(raptor_iostream
*iostr
);
1764 int raptor_iostream_decimal_write(int integer
, raptor_iostream
* iostr
);
1766 int raptor_iostream_hexadecimal_write(unsigned int integer
, int width
, raptor_iostream
* iostr
);
1768 int raptor_stringbuffer_write(raptor_stringbuffer
*sb
, raptor_iostream
* iostr
);
1770 int raptor_uri_write(raptor_uri
*uri
, raptor_iostream
*iostr
);
1772 int raptor_iostream_read_bytes(void *ptr
, size_t size
, size_t nmemb
, raptor_iostream
* iostr
);
1774 int raptor_iostream_read_eof(raptor_iostream
*iostr
);
1776 /* I/O Stream utility functions */
1778 int raptor_string_ntriples_write(const unsigned char *string
, size_t len
, const char delim
, raptor_iostream
*iostr
);
1780 int raptor_bnodeid_ntriples_write(const unsigned char *bnodeid
, size_t len
, raptor_iostream
*iostr
);
1782 int raptor_string_python_write(const unsigned char *string
, size_t len
, const char delim
, int flags
, raptor_iostream
*iostr
);
1784 int raptor_statement_ntriples_write(const raptor_statement
*statement
, raptor_iostream
* iostr
, int write_graph_term
);
1788 /* Parser and Serializer options */
1791 * raptor_option_value_type:
1792 * @RAPTOR_OPTION_VALUE_TYPE_BOOL: Boolean integer value. Non-0 is true
1793 * @RAPTOR_OPTION_VALUE_TYPE_INT: Decimal integer value
1794 * @RAPTOR_OPTION_VALUE_TYPE_STRING: String value
1795 * @RAPTOR_OPTION_VALUE_TYPE_URI: URI String value.
1796 * @RAPTOR_OPTION_VALUE_TYPE_LAST: internal
1798 * Option value types.
1801 RAPTOR_OPTION_VALUE_TYPE_BOOL
,
1802 RAPTOR_OPTION_VALUE_TYPE_INT
,
1803 RAPTOR_OPTION_VALUE_TYPE_STRING
,
1804 RAPTOR_OPTION_VALUE_TYPE_URI
,
1805 RAPTOR_OPTION_VALUE_TYPE_LAST
= RAPTOR_OPTION_VALUE_TYPE_URI
1806 } raptor_option_value_type
;
1810 * raptor_option_description:
1811 * @domain: domain ID
1812 * @option: option ID
1813 * @value_type: data type of option value
1814 * @name: short name for option
1815 * @name_len: length of @name
1816 * @label: description of option
1817 * @uri: URI identifying option
1819 * Description of an option for a domain.
1822 raptor_domain domain
;
1823 raptor_option option
;
1824 raptor_option_value_type value_type
;
1829 } raptor_option_description
;
1833 unsigned int raptor_option_get_count(void);
1835 const char* raptor_option_get_value_type_label(const raptor_option_value_type type
);
1837 void raptor_free_option_description(raptor_option_description
* option_description
);
1839 raptor_option_description
* raptor_world_get_option_description(raptor_world
* world
, const raptor_domain domain
, const raptor_option option
);
1842 /* SAX2 element Class (raptor_xml_element) */
1844 raptor_xml_element
* raptor_new_xml_element(raptor_qname
* name
, const unsigned char* xml_language
, raptor_uri
* xml_base
);
1846 raptor_xml_element
* raptor_new_xml_element_from_namespace_local_name(raptor_namespace
*ns
, const unsigned char *name
, const unsigned char *xml_language
, raptor_uri
*xml_base
);
1848 void raptor_free_xml_element(raptor_xml_element
*element
);
1852 raptor_qname
* raptor_xml_element_get_name(raptor_xml_element
*xml_element
);
1854 void raptor_xml_element_set_attributes(raptor_xml_element
* xml_element
, raptor_qname
**attributes
, int count
);
1856 raptor_qname
** raptor_xml_element_get_attributes(raptor_xml_element
* xml_element
);
1858 int raptor_xml_element_get_attributes_count(raptor_xml_element
* xml_element
);
1860 int raptor_xml_element_declare_namespace(raptor_xml_element
* xml_element
, raptor_namespace
*nspace
);
1862 int raptor_xml_element_write(raptor_xml_element
*element
, raptor_namespace_stack
*nstack
, int is_empty
, int is_end
, int depth
, raptor_iostream
*iostr
);
1864 int raptor_xml_element_is_empty(raptor_xml_element
* xml_element
);
1866 const unsigned char* raptor_xml_element_get_language(raptor_xml_element
* xml_element
);
1869 /* XML Writer Class (raptor_xml_writer) */
1871 raptor_xml_writer
* raptor_new_xml_writer(raptor_world
* world
, raptor_namespace_stack
*nstack
, raptor_iostream
* iostr
);
1873 void raptor_free_xml_writer(raptor_xml_writer
* xml_writer
);
1877 void raptor_xml_writer_empty_element(raptor_xml_writer
* xml_writer
, raptor_xml_element
*element
);
1879 void raptor_xml_writer_start_element(raptor_xml_writer
* xml_writer
, raptor_xml_element
*element
);
1881 void raptor_xml_writer_end_element(raptor_xml_writer
* xml_writer
, raptor_xml_element
*element
);
1883 void raptor_xml_writer_newline(raptor_xml_writer
* xml_writer
);
1885 void raptor_xml_writer_cdata(raptor_xml_writer
* xml_writer
, const unsigned char *s
);
1887 void raptor_xml_writer_cdata_counted(raptor_xml_writer
* xml_writer
, const unsigned char *s
, unsigned int len
);
1889 void raptor_xml_writer_raw(raptor_xml_writer
* xml_writer
, const unsigned char *s
);
1891 void raptor_xml_writer_raw_counted(raptor_xml_writer
* xml_writer
, const unsigned char *s
, unsigned int len
);
1893 void raptor_xml_writer_comment(raptor_xml_writer
* xml_writer
, const unsigned char *s
);
1895 void raptor_xml_writer_comment_counted(raptor_xml_writer
* xml_writer
, const unsigned char *s
, unsigned int len
);
1897 void raptor_xml_writer_flush(raptor_xml_writer
* xml_writer
);
1899 int raptor_xml_writer_set_option(raptor_xml_writer
*xml_writer
, raptor_option option
, char* string
, int integer
);
1901 int raptor_xml_writer_get_option(raptor_xml_writer
*xml_writer
, raptor_option option
, char** string_p
, int* integer_p
);
1903 int raptor_xml_writer_get_depth(raptor_xml_writer
*xml_writer
);
1906 * raptor_sax2_start_element_handler:
1907 * @user_data: user data
1908 * @xml_element: XML element
1910 * SAX2 start element handler
1912 typedef void (*raptor_sax2_start_element_handler
)(void *user_data
, raptor_xml_element
*xml_element
);
1915 * raptor_sax2_end_element_handler:
1916 * @user_data: user data
1917 * @xml_element: XML element
1919 * SAX2 end element handler
1921 typedef void (*raptor_sax2_end_element_handler
)(void *user_data
, raptor_xml_element
* xml_element
);
1924 * raptor_sax2_characters_handler:
1925 * @user_data: user data
1926 * @xml_element: XML element
1930 * SAX2 characters handler
1932 typedef void (*raptor_sax2_characters_handler
)(void *user_data
, raptor_xml_element
* xml_element
, const unsigned char *s
, int len
);
1935 * raptor_sax2_cdata_handler:
1936 * @user_data: user data
1937 * @xml_element: XML element
1941 * SAX2 CDATA section handler
1943 typedef void (*raptor_sax2_cdata_handler
)(void *user_data
, raptor_xml_element
* xml_element
, const unsigned char *s
, int len
);
1946 * raptor_sax2_comment_handler:
1947 * @user_data: user data
1948 * @xml_element: XML element
1951 * SAX2 XML comment handler
1953 typedef void (*raptor_sax2_comment_handler
)(void *user_data
, raptor_xml_element
* xml_element
, const unsigned char *s
);
1956 * raptor_sax2_unparsed_entity_decl_handler:
1957 * @user_data: user data
1958 * @entityName: entity name
1960 * @systemId: system ID
1961 * @publicId: public ID
1962 * @notationName: notation name
1964 * SAX2 unparsed entity (NDATA) handler
1966 typedef void (*raptor_sax2_unparsed_entity_decl_handler
)(void *user_data
, const unsigned char* entityName
, const unsigned char* base
, const unsigned char* systemId
, const unsigned char* publicId
, const unsigned char* notationName
);
1969 * raptor_sax2_external_entity_ref_handler:
1970 * @user_data: user data
1973 * @systemId: system ID
1974 * @publicId: public ID
1976 * SAX2 external entity reference handler
1978 * Return value: 0 if processing should not continue because of a
1979 * fatal error in the handling of the external entity.
1981 typedef int (*raptor_sax2_external_entity_ref_handler
)(void *user_data
, const unsigned char* context
, const unsigned char* base
, const unsigned char* systemId
, const unsigned char* publicId
);
1986 raptor_sax2
* raptor_new_sax2(raptor_world
*world
, raptor_locator
*locator
, void* user_data
);
1988 void raptor_free_sax2(raptor_sax2
*sax2
);
1992 void raptor_sax2_set_start_element_handler(raptor_sax2
* sax2
, raptor_sax2_start_element_handler handler
);
1994 void raptor_sax2_set_end_element_handler(raptor_sax2
* sax2
, raptor_sax2_end_element_handler handler
);
1996 void raptor_sax2_set_characters_handler(raptor_sax2
* sax2
, raptor_sax2_characters_handler handler
);
1998 void raptor_sax2_set_cdata_handler(raptor_sax2
* sax2
, raptor_sax2_cdata_handler handler
);
2000 void raptor_sax2_set_comment_handler(raptor_sax2
* sax2
, raptor_sax2_comment_handler handler
);
2002 void raptor_sax2_set_unparsed_entity_decl_handler(raptor_sax2
* sax2
, raptor_sax2_unparsed_entity_decl_handler handler
);
2004 void raptor_sax2_set_external_entity_ref_handler(raptor_sax2
* sax2
, raptor_sax2_external_entity_ref_handler handler
);
2006 void raptor_sax2_set_namespace_handler(raptor_sax2
* sax2
, raptor_namespace_handler handler
);
2008 void raptor_sax2_set_uri_filter(raptor_sax2
* sax2
, raptor_uri_filter_func filter
, void *user_data
);
2010 void raptor_sax2_parse_start(raptor_sax2
*sax2
, raptor_uri
*base_uri
);
2012 int raptor_sax2_parse_chunk(raptor_sax2
* sax2
, const unsigned char *buffer
, size_t len
, int is_end
);
2014 const unsigned char* raptor_sax2_inscope_xml_language(raptor_sax2
* sax2
);
2016 raptor_uri
* raptor_sax2_inscope_base_uri(raptor_sax2
* sax2
);
2027 typedef struct raptor_avltree_s raptor_avltree
;
2030 * raptor_avltree_iterator:
2032 * AVL Tree Iterator as created by raptor_new_avltree_iterator()
2034 typedef struct raptor_avltree_iterator_s raptor_avltree_iterator
;
2037 * raptor_avltree_visit_handler:
2038 * @depth: depth of object in tree
2039 * @data: data object being visited
2040 * @user_data: user data arg to raptor_avltree_visit()
2042 * AVL Tree visitor function as given to raptor_avltree_visit()
2044 * Return value: non-0 to terminate visit early.
2046 typedef int (*raptor_avltree_visit_handler
)(int depth
, void* data
, void *user_data
);
2050 * raptor_avltree_bitflags:
2051 * @RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES: If set raptor_avltree_add() will replace any duplicate items. If not set, raptor_avltree_add() will not replace them and will return status >0 when adding a duplicate. (Default is not set)
2053 * Bit flags for AVL Tree class constructor raptor_new_avltree()
2056 RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES
= 1
2057 } raptor_avltree_bitflags
;
2061 raptor_avltree
* raptor_new_avltree(raptor_data_compare_handler compare_handler
, raptor_data_free_handler free_handler
, unsigned int flags
);
2063 void raptor_free_avltree(raptor_avltree
* tree
);
2067 int raptor_avltree_add(raptor_avltree
* tree
, void* p_data
);
2069 void* raptor_avltree_remove(raptor_avltree
* tree
, void* p_data
);
2071 int raptor_avltree_delete(raptor_avltree
* tree
, void* p_data
);
2073 void* raptor_avltree_search(raptor_avltree
* tree
, const void* p_data
);
2075 int raptor_avltree_visit(raptor_avltree
* tree
, raptor_avltree_visit_handler visit_handler
, void* user_data
);
2077 int raptor_avltree_size(raptor_avltree
* tree
);
2079 void raptor_avltree_set_print_handler(raptor_avltree
* tree
, raptor_data_print_handler print_handler
);
2081 int raptor_avltree_print(raptor_avltree
* tree
, FILE* stream
);
2084 raptor_avltree_iterator
* raptor_new_avltree_iterator(raptor_avltree
* tree
, void* range
, raptor_data_free_handler range_free_handler
, int direction
);
2086 void raptor_free_avltree_iterator(raptor_avltree_iterator
* iterator
);
2089 int raptor_avltree_iterator_is_end(raptor_avltree_iterator
* iterator
);
2091 int raptor_avltree_iterator_next(raptor_avltree_iterator
* iterator
);
2093 void* raptor_avltree_iterator_get(raptor_avltree_iterator
* iterator
);