1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
|
/* -*- Mode: c; c-basic-offset: 2 -*-
*
* raptor.h - Redland Parser Toolkit for RDF (Raptor) interfaces and definition
*
* $Id$
*
* Copyright (C) 2000-2004, David Beckett http://purl.org/net/dajobe/
* Institute for Learning and Research Technology http://www.ilrt.bristol.ac.uk/
* University of Bristol, UK http://www.bristol.ac.uk/
*
* This package is Free Software and part of Redland http://librdf.org/
*
* It is licensed under the following three licenses as alternatives:
* 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
* 2. GNU General Public License (GPL) V2 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
* the above three licenses.
*
* See LICENSE.html or LICENSE.txt at the top of this package for the
* complete terms and further detail along with the license texts for
* the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
*
*
*/
#ifndef RAPTOR_H
#define RAPTOR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/* Required for va_list in raptor_vsnprintf */
#include <stdarg.h>
#ifdef WIN32
# ifdef RAPTOR_STATIC
# define RAPTOR_API
# else
# ifdef RAPTOR_INTERNAL
# define RAPTOR_API _declspec(dllexport)
# else
# define RAPTOR_API _declspec(dllimport)
# endif
# endif
#else
# define RAPTOR_API
#endif
/* Use gcc 3.1+ feature to allow marking of deprecated API calls.
* This gives a warning during compiling.
*/
#if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
#ifdef __APPLE_CC__
/* OSX gcc cpp-precomp is broken */
#define RAPTOR_DEPRECATED
#else
#define RAPTOR_DEPRECATED __attribute__((deprecated))
#endif
#else
#define RAPTOR_DEPRECATED
#endif
typedef void* raptor_uri;
/* Public statics */
RAPTOR_API extern const char * const raptor_short_copyright_string;
RAPTOR_API extern const char * const raptor_copyright_string;
RAPTOR_API extern const char * const raptor_version_string;
RAPTOR_API extern const unsigned int raptor_version_major;
RAPTOR_API extern const unsigned int raptor_version_minor;
RAPTOR_API extern const unsigned int raptor_version_release;
RAPTOR_API extern const unsigned int raptor_version_decimal;
RAPTOR_API extern const char * const raptor_xml_namespace_uri;
RAPTOR_API extern const char * const raptor_rdf_namespace_uri;
RAPTOR_API extern const char * const raptor_rdf_schema_namespace_uri;
RAPTOR_API extern const char * const raptor_xmlschema_datatypes_namespace_uri;
RAPTOR_API extern const char * const raptor_owl_namespace_uri;
RAPTOR_API extern const unsigned int raptor_rdf_namespace_uri_len;
RAPTOR_API extern const char * const raptor_xml_literal_datatype_uri_string;
RAPTOR_API extern const unsigned int raptor_xml_literal_datatype_uri_string_len;
/* Public structure */
typedef struct raptor_parser_s raptor_parser;
typedef struct raptor_serializer_s raptor_serializer;
typedef struct raptor_www_s raptor_www;
typedef struct raptor_iostream_s raptor_iostream;
typedef struct raptor_sax2_element_s raptor_sax2_element;
typedef struct raptor_xml_writer_s raptor_xml_writer;
typedef struct raptor_qname_s raptor_qname;
typedef struct raptor_namespace_s raptor_namespace;
typedef struct raptor_namespace_stack_s raptor_namespace_stack;
/* OLD structure - can't deprecate a typedef */
typedef raptor_parser raptor_ntriples_parser;
typedef enum {
RAPTOR_IDENTIFIER_TYPE_UNKNOWN, /* Unknown type - illegal */
RAPTOR_IDENTIFIER_TYPE_RESOURCE, /* Resource URI (e.g. rdf:about) */
RAPTOR_IDENTIFIER_TYPE_ANONYMOUS, /* _:foo N-Triples, or generated */
RAPTOR_IDENTIFIER_TYPE_PREDICATE, /* Predicate URI */
RAPTOR_IDENTIFIER_TYPE_ORDINAL, /* rdf:li, rdf:_<n> etc. */
RAPTOR_IDENTIFIER_TYPE_LITERAL, /* regular literal */
RAPTOR_IDENTIFIER_TYPE_XML_LITERAL /* rdf:parseType="Literal" */
} raptor_identifier_type;
typedef enum { RAPTOR_URI_SOURCE_UNKNOWN, RAPTOR_URI_SOURCE_NOT_URI, RAPTOR_URI_SOURCE_ELEMENT, RAPTOR_URI_SOURCE_ATTRIBUTE, RAPTOR_URI_SOURCE_ID, RAPTOR_URI_SOURCE_URI, RAPTOR_URI_SOURCE_GENERATED, RAPTOR_URI_SOURCE_BLANK_ID } raptor_uri_source;
typedef enum { RAPTOR_NTRIPLES_TERM_TYPE_URI_REF, RAPTOR_NTRIPLES_TERM_TYPE_BLANK_NODE, RAPTOR_NTRIPLES_TERM_TYPE_LITERAL } raptor_ntriples_term_type;
typedef struct {
raptor_uri *uri;
const char *file;
int line;
int column;
int byte;
} raptor_locator;
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_LAST=RAPTOR_FEATURE_RELATIVE_URIS
} raptor_feature;
typedef enum {
RAPTOR_GENID_TYPE_BNODEID,
RAPTOR_GENID_TYPE_BAGID
} raptor_genid_type;
typedef struct {
raptor_identifier_type type;
raptor_uri *uri;
raptor_uri_source uri_source;
const unsigned char *id;
int ordinal;
int is_malloced;
const unsigned char *literal;
raptor_uri *literal_datatype;
const unsigned char *literal_language;
} raptor_identifier;
/* Returned by statement_handler */
typedef struct {
const void *subject;
raptor_identifier_type subject_type;
const void *predicate;
raptor_identifier_type predicate_type;
const void *object;
raptor_identifier_type object_type;
raptor_uri *object_literal_datatype;
const unsigned char *object_literal_language;
} raptor_statement;
typedef raptor_uri* (*raptor_new_uri_func) (void *context, const unsigned char *uri_string);
typedef raptor_uri* (*raptor_new_uri_from_uri_local_name_func) (void *context, raptor_uri *uri, const unsigned char *local_name);
typedef raptor_uri* (*raptor_new_uri_relative_to_base_func) (void *context, raptor_uri *base_uri, const unsigned char *uri_string);
typedef raptor_uri* (*raptor_new_uri_for_rdf_concept_func) (void *context, const char *name);
typedef void (*raptor_free_uri_func) (void *context, raptor_uri *uri);
typedef int (*raptor_uri_equals_func) (void *context, raptor_uri* uri1, raptor_uri* uri2);
typedef raptor_uri* (*raptor_uri_copy_func) (void *context, raptor_uri *uri);
typedef unsigned char* (*raptor_uri_as_string_func)(void *context, raptor_uri *uri);
typedef unsigned char* (*raptor_uri_as_counted_string_func)(void *context, raptor_uri *uri, size_t* len_p);
typedef struct {
/* constructors */
raptor_new_uri_func new_uri;
raptor_new_uri_from_uri_local_name_func new_uri_from_uri_local_name;
raptor_new_uri_relative_to_base_func new_uri_relative_to_base;
raptor_new_uri_for_rdf_concept_func new_uri_for_rdf_concept;
/* destructor */
raptor_free_uri_func free_uri;
/* methods */
raptor_uri_equals_func uri_equals;
raptor_uri_copy_func uri_copy; /* well, copy constructor */
raptor_uri_as_string_func uri_as_string;
raptor_uri_as_counted_string_func uri_as_counted_string;
int initialised;
} raptor_uri_handler;
typedef void (*raptor_simple_message_handler)(void *user_data, const char *message, ...);
typedef void (*raptor_message_handler)(void *user_data, raptor_locator* locator, const char *message);
typedef void (*raptor_statement_handler)(void *user_data, const raptor_statement *statement);
typedef unsigned char* (*raptor_generate_id_handler)(void *user_data, raptor_genid_type type, unsigned char* user_bnodeid);
typedef raptor_uri* (*raptor_container_test_handler)(raptor_uri *element_uri);
typedef void (*raptor_www_write_bytes_handler)(raptor_www* www, void *userdata, const void *ptr, size_t size, size_t nmemb);
typedef void (*raptor_www_content_type_handler)(raptor_www* www, void *userdata, const char *content_type);
/* Public functions */
RAPTOR_API void raptor_init(void);
RAPTOR_API void raptor_finish(void);
/* Get parser names */
RAPTOR_API int raptor_parsers_enumerate(const unsigned int counter, const char **name, const char **label);
RAPTOR_API int raptor_syntaxes_enumerate(const unsigned int counter, const char **name, const char **label, const char **mime_type, const unsigned char **uri_string);
RAPTOR_API int raptor_syntax_name_check(const char *name);
RAPTOR_API const char* raptor_guess_parser_name(raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier);
/* Create */
RAPTOR_API raptor_parser* raptor_new_parser(const char *name);
RAPTOR_API raptor_parser* raptor_new_parser_for_content(raptor_uri *uri, const char *mime_type, const unsigned char *buffer, size_t len, const unsigned char *identifier);
RAPTOR_API int raptor_start_parse(raptor_parser *rdf_parser, raptor_uri *uri);
/* Destroy */
RAPTOR_API void raptor_free_parser(raptor_parser* parser);
/* Handlers */
RAPTOR_API void raptor_set_fatal_error_handler(raptor_parser* parser, void *user_data, raptor_message_handler handler);
RAPTOR_API void raptor_set_error_handler(raptor_parser* parser, void *user_data, raptor_message_handler handler);
RAPTOR_API void raptor_set_warning_handler(raptor_parser* parser, void *user_data, raptor_message_handler handler);
RAPTOR_API void raptor_set_statement_handler(raptor_parser* parser, void *user_data, raptor_statement_handler handler);
RAPTOR_API void raptor_set_generate_id_handler(raptor_parser* parser, void *user_data, raptor_generate_id_handler handler);
RAPTOR_API void raptor_print_statement(const raptor_statement * statement, FILE *stream);
RAPTOR_API void raptor_print_statement_as_ntriples(const raptor_statement * statement, FILE *stream);
RAPTOR_API RAPTOR_DEPRECATED void raptor_print_statement_detailed(const raptor_statement * statement, int detailed, FILE *stream);
RAPTOR_API unsigned char* raptor_statement_part_as_counted_string(const void *term, raptor_identifier_type type, raptor_uri* literal_datatype, const unsigned char *literal_language, size_t* len_p);
RAPTOR_API unsigned char* raptor_statement_part_as_string(const void *term, raptor_identifier_type type, raptor_uri* literal_datatype, const unsigned char *literal_language);
RAPTOR_API raptor_locator* raptor_get_locator(raptor_parser* rdf_parser);
RAPTOR_API void raptor_set_default_generate_id_parameters(raptor_parser* rdf_parser, char *prefix, int base);
/* Parsing functions */
RAPTOR_API int raptor_parse_chunk(raptor_parser* rdf_parser, const unsigned char *buffer, size_t len, int is_end);
RAPTOR_API int raptor_parse_file_stream(raptor_parser* rdf_parser, FILE *stream, const char *filename, raptor_uri *base_uri);
RAPTOR_API int raptor_parse_file(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri);
RAPTOR_API int raptor_parse_uri(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri);
RAPTOR_API int raptor_parse_uri_with_connection(raptor_parser* rdf_parser, raptor_uri *uri, raptor_uri *base_uri, void *connection);
RAPTOR_API void raptor_parse_abort(raptor_parser* rdf_parser);
/* Utility functions */
RAPTOR_API void raptor_print_locator(FILE *stream, raptor_locator* locator);
RAPTOR_API int raptor_format_locator(char *buffer, size_t length, raptor_locator* locator);
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);
RAPTOR_API const char* raptor_get_name(raptor_parser *rdf_parser);
RAPTOR_API const char* raptor_get_label(raptor_parser *rdf_parser);
RAPTOR_API const char* raptor_get_mime_type(raptor_parser *rdf_parser);
RAPTOR_API int raptor_features_enumerate(const raptor_feature feature, const char **name, raptor_uri **uri, const char **label);
RAPTOR_API int raptor_set_feature(raptor_parser *parser, raptor_feature feature, int value);
RAPTOR_API int raptor_get_feature(raptor_parser *parser, raptor_feature feature);
RAPTOR_API void raptor_set_parser_strict(raptor_parser* rdf_parser, int is_strict);
/* Get serializer names */
RAPTOR_API int raptor_serializers_enumerate(const unsigned int counter, const char **name, const char **label, const char **mime_type, const unsigned char **uri_string);
RAPTOR_API int raptor_serializer_syntax_name_check(const char *name);
/* Serializing */
RAPTOR_API raptor_serializer* raptor_new_serializer(const char *name);
RAPTOR_API void raptor_free_serializer(raptor_serializer* rdf_serializer);
RAPTOR_API int raptor_serialize_start(raptor_serializer *rdf_serializer, raptor_uri *uri, raptor_iostream *iostream);
RAPTOR_API int raptor_serialize_start_to_filename(raptor_serializer *rdf_serializer, const char *filename);
RAPTOR_API int raptor_serialize_start_to_string(raptor_serializer *rdf_serializer, raptor_uri *uri, void **string_p, size_t *length_p);
RAPTOR_API int raptor_serialize_start_to_file_handle(raptor_serializer *rdf_serializer, raptor_uri *uri, FILE *fh);
RAPTOR_API int raptor_serialize_set_namespace(raptor_serializer* rdf_serializer, raptor_uri *uri, const unsigned char *prefix);
RAPTOR_API int raptor_serialize_statement(raptor_serializer* rdf_serializer, const raptor_statement *statement);
RAPTOR_API int raptor_serialize_end(raptor_serializer *rdf_serializer);
RAPTOR_API raptor_iostream* raptor_serializer_get_iostream(raptor_serializer *serializer);
RAPTOR_API void raptor_serializer_set_error_handler(raptor_serializer* serializer, void *user_data, raptor_message_handler handler);
RAPTOR_API void raptor_serializer_set_warning_handler(raptor_serializer* serializer, void *user_data, raptor_message_handler handler);
RAPTOR_API raptor_locator* raptor_serializer_get_locator(raptor_serializer *rdf_serializer);
RAPTOR_API int raptor_serializer_features_enumerate(const raptor_feature feature, const char **name, raptor_uri **uri, const char **label);
RAPTOR_API int raptor_serializer_set_feature(raptor_serializer *serializer, raptor_feature feature, int value);
RAPTOR_API int raptor_serializer_get_feature(raptor_serializer *serializer, raptor_feature feature);
/* memory functions */
RAPTOR_API void raptor_free_memory(void *ptr);
RAPTOR_API void* raptor_alloc_memory(size_t size);
RAPTOR_API void* raptor_calloc_memory(size_t nmemb, size_t size);
/* URI functions */
RAPTOR_API raptor_uri* raptor_new_uri(const unsigned char *uri_string);
RAPTOR_API raptor_uri* raptor_new_uri_from_uri_local_name(raptor_uri *uri, const unsigned char *local_name);
RAPTOR_API raptor_uri* raptor_new_uri_relative_to_base(raptor_uri *base_uri, const unsigned char *uri_string);
RAPTOR_API raptor_uri* raptor_new_uri_from_id(raptor_uri *base_uri, const unsigned char *id);
RAPTOR_API raptor_uri* raptor_new_uri_for_rdf_concept(const char *name);
RAPTOR_API void raptor_free_uri(raptor_uri *uri);
RAPTOR_API int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2);
RAPTOR_API raptor_uri* raptor_uri_copy(raptor_uri *uri);
RAPTOR_API unsigned char* raptor_uri_as_string(raptor_uri *uri);
RAPTOR_API unsigned char* raptor_uri_as_counted_string(raptor_uri *uri, size_t* len_p);
/* Make an xml:base-compatible URI from an existing one */
RAPTOR_API raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri);
/* Make a URI suitable for retrieval (no fragment, has path) from an existing one */
RAPTOR_API raptor_uri* raptor_new_uri_for_retrieval(raptor_uri* old_uri);
/* Identifier functions */
RAPTOR_API raptor_identifier* raptor_new_identifier(raptor_identifier_type type, raptor_uri *uri, raptor_uri_source uri_source, const unsigned char *id, const unsigned char *literal, raptor_uri *literal_datatype, const unsigned char *literal_language);
RAPTOR_API int raptor_copy_identifier(raptor_identifier *dest, raptor_identifier *src);
RAPTOR_API void raptor_free_identifier(raptor_identifier *identifier);
/* Utility functions */
RAPTOR_API int raptor_print_ntriples_string(FILE *stream, const unsigned char *string, const char delim);
RAPTOR_API unsigned char* raptor_ntriples_string_as_utf8_string(raptor_parser* rdf_parser, unsigned char *src, int len, size_t *dest_lenp);
RAPTOR_API const char* raptor_ntriples_term_as_string (raptor_ntriples_term_type term);
RAPTOR_API int raptor_xml_escape_string(const unsigned char *string, size_t len, unsigned char *buffer, size_t length, char quote, raptor_simple_message_handler error_handler, void *error_data);
RAPTOR_API int raptor_iostream_write_xml_escaped_string(raptor_iostream* iostr, const unsigned char *string, size_t len, char quote, raptor_simple_message_handler error_handler, void *error_data);
RAPTOR_API char* raptor_vsnprintf(const char *message, va_list arguments);
/* raptor_xml_writer.c */
/* NOT PUBLIC YET - SEE raptor_internal.h */
/* raptor_rfc2396.c */
RAPTOR_API void raptor_uri_resolve_uri_reference (const unsigned char *base_uri, const unsigned char *reference_uri, char unsigned *buffer, size_t length);
/* raptor_uri.c */
RAPTOR_API unsigned char *raptor_uri_filename_to_uri_string(const char *filename);
RAPTOR_API char *raptor_uri_uri_string_to_filename(const unsigned char *uri_string);
RAPTOR_API char *raptor_uri_uri_string_to_filename_fragment(const unsigned char *uri_string, unsigned char **fragment_p);
RAPTOR_API int raptor_uri_is_file_uri(const unsigned char* uri_string);
RAPTOR_API unsigned char* raptor_uri_to_relative_counted_uri_string(raptor_uri *base_uri, raptor_uri *reference_uri, size_t *length_p);
RAPTOR_API unsigned char* raptor_uri_to_relative_uri_string(raptor_uri *base_uri, raptor_uri *reference_uri);
RAPTOR_API void raptor_uri_init(void);
RAPTOR_API void raptor_uri_set_handler(raptor_uri_handler *handler, void *context);
RAPTOR_API void raptor_uri_get_handler(raptor_uri_handler **handler, void **context);
#define RAPTOR_RDF_MS_URI "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
#define RAPTOR_RDF_SCHEMA_URI "http://www.w3.org/2000/01/rdf-schema#"
#define RAPTOR_XMLSCHEMA_DATATYPES_URI "http://www.w3.org/2001/XMLSchema#"
#define RAPTOR_OWL_URI "http://www.w3.org/2002/07/owl#"
/* raptor_www */
RAPTOR_API void raptor_www_init(void);
RAPTOR_API void raptor_www_finish(void);
RAPTOR_API void raptor_www_no_www_library_init_finish(void);
RAPTOR_API raptor_www *raptor_www_new(void);
RAPTOR_API raptor_www *raptor_www_new_with_connection(void* connection);
RAPTOR_API void raptor_www_free(raptor_www *www);
RAPTOR_API void raptor_www_set_user_agent(raptor_www *www, const char *user_agent);
RAPTOR_API void raptor_www_set_proxy(raptor_www *www, const char *proxy);
RAPTOR_API void raptor_www_set_http_accept(raptor_www *www, const char *value);
RAPTOR_API void raptor_www_set_write_bytes_handler(raptor_www *www, raptor_www_write_bytes_handler handler, void *user_data);
RAPTOR_API void raptor_www_set_content_type_handler(raptor_www *www, raptor_www_content_type_handler handler, void *user_data);
RAPTOR_API void raptor_www_set_error_handler(raptor_www *www, raptor_message_handler error_handler, void *error_data);
RAPTOR_API int raptor_www_fetch(raptor_www *www, raptor_uri *uri);
RAPTOR_API int raptor_www_fetch_to_string(raptor_www *www, raptor_uri *uri, void **string_p, size_t *length_p, void *(*malloc_handler)(size_t size));
RAPTOR_API void* raptor_www_get_connection(raptor_www *www);
RAPTOR_API void raptor_www_abort(raptor_www *www, const char *reason);
/* raptor_qname - XML qnames */
RAPTOR_API raptor_qname* raptor_new_qname(raptor_namespace_stack *nstack, const unsigned char *name, const unsigned char *value, raptor_simple_message_handler error_handler, void *error_data);
RAPTOR_API raptor_qname* raptor_new_qname_from_namespace_local_name(raptor_namespace *ns, const unsigned char *local_name, const unsigned char *value);
RAPTOR_API void raptor_free_qname(raptor_qname* name);
RAPTOR_API 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, const unsigned char *name, size_t name_len, raptor_simple_message_handler error_handler, void *error_data);
RAPTOR_API int raptor_iostream_write_qname(raptor_iostream* iostr, raptor_qname *qname);
/* raptor_namespace_stack - stack of XML namespaces */
RAPTOR_API raptor_namespace* raptor_new_namespace_from_uri(raptor_namespace_stack *nstack, const unsigned char *prefix, raptor_uri* ns_uri, int depth);
RAPTOR_API raptor_namespace_stack* raptor_new_namespaces(raptor_uri_handler *uri_handler, void *uri_context, raptor_simple_message_handler error_handler, void *error_data, int defaults);
RAPTOR_API void raptor_namespaces_init(raptor_namespace_stack *nstack, raptor_uri_handler *handler, void *context, raptor_simple_message_handler error_handler, void *error_data, int defaults);
RAPTOR_API void raptor_namespaces_clear(raptor_namespace_stack *nstack);
RAPTOR_API void raptor_free_namespaces(raptor_namespace_stack *nstack);
RAPTOR_API void raptor_namespaces_start_namespace(raptor_namespace_stack *nstack, raptor_namespace *nspace);
RAPTOR_API int raptor_namespaces_start_namespace_full(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *nspace, int depth);
RAPTOR_API void raptor_namespaces_end_for_depth(raptor_namespace_stack *nstack, int depth);
RAPTOR_API raptor_namespace* raptor_namespaces_get_default_namespace(raptor_namespace_stack *nstack);
RAPTOR_API raptor_namespace *raptor_namespaces_find_namespace(raptor_namespace_stack *nstack, const unsigned char *prefix, int prefix_length);
RAPTOR_API int raptor_namespaces_namespace_in_scope(raptor_namespace_stack *nstack, const raptor_namespace *nspace);
/* raptor_namespace - XML namespace */
RAPTOR_API raptor_namespace* raptor_new_namespace(raptor_namespace_stack *nstack, const unsigned char *prefix, const unsigned char *ns_uri_string, int depth);
RAPTOR_API void raptor_free_namespace(raptor_namespace *ns);
RAPTOR_API int raptor_namespace_copy(raptor_namespace_stack *nstack, raptor_namespace *ns, int new_depth);
RAPTOR_API raptor_uri* raptor_namespace_get_uri(const raptor_namespace *ns);
RAPTOR_API const unsigned char* raptor_namespace_get_prefix(const raptor_namespace *ns);
RAPTOR_API unsigned char *raptor_namespaces_format(const raptor_namespace *ns, size_t *length_p);
RAPTOR_API int raptor_iostream_write_namespace(raptor_iostream* iostr, raptor_namespace *ns);
RAPTOR_API int raptor_new_namespace_parts_from_string(const unsigned char *string, unsigned char **prefix, unsigned char **uri_string);
typedef struct raptor_stringbuffer_s raptor_stringbuffer;
/* Sequence class */
typedef struct raptor_sequence_s raptor_sequence;
typedef void (raptor_sequence_free_handler(void*));
typedef void (raptor_sequence_print_handler(void *object, FILE *fh));
/* Create */
RAPTOR_API raptor_sequence* raptor_new_sequence(raptor_sequence_free_handler* free_handler, raptor_sequence_print_handler* print_handler);
/* Destroy */
RAPTOR_API void raptor_free_sequence(raptor_sequence* seq);
/* Methods */
RAPTOR_API int raptor_sequence_size(raptor_sequence* seq);
RAPTOR_API int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data);
RAPTOR_API int raptor_sequence_push(raptor_sequence* seq, void *data);
RAPTOR_API int raptor_sequence_shift(raptor_sequence* seq, void *data);
RAPTOR_API void* raptor_sequence_get_at(raptor_sequence* seq, int idx);
RAPTOR_API void* raptor_sequence_pop(raptor_sequence* seq);
RAPTOR_API void* raptor_sequence_unshift(raptor_sequence* seq);
RAPTOR_API int raptor_compare_strings(const void *a, const void *b);
RAPTOR_API void raptor_sequence_sort(raptor_sequence* seq, int(*compare)(const void *, const void *));
/* helper for printing sequences of strings */
RAPTOR_API void raptor_sequence_print_string(char *data, FILE *fh);
RAPTOR_API void raptor_sequence_print_uri(char *data, FILE *fh);
RAPTOR_API void raptor_sequence_set_print_handler(raptor_sequence *seq, raptor_sequence_print_handler *print_handler);
RAPTOR_API void raptor_sequence_print(raptor_sequence* seq, FILE* fh);
RAPTOR_API int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src);
/* raptor_utf8.c */
RAPTOR_API int raptor_unicode_char_to_utf8(unsigned long c, unsigned char *output);
RAPTOR_API int raptor_utf8_to_unicode_char(unsigned long *output, const unsigned char *input, int length);
/* raptor_stringbuffer */
RAPTOR_API raptor_stringbuffer* raptor_new_stringbuffer(void);
RAPTOR_API void raptor_free_stringbuffer(raptor_stringbuffer *stringbuffer);
RAPTOR_API int raptor_stringbuffer_append_counted_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, size_t length, int do_copy);
RAPTOR_API int raptor_stringbuffer_append_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, int do_copy);
RAPTOR_API int raptor_stringbuffer_append_decimal(raptor_stringbuffer* stringbuffer, int integer);
RAPTOR_API int raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer* stringbuffer, raptor_stringbuffer* append);
RAPTOR_API int raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, size_t length, int do_copy);
RAPTOR_API int raptor_stringbuffer_prepend_string(raptor_stringbuffer* stringbuffer, const unsigned char *string, int do_copy);
RAPTOR_API unsigned char * raptor_stringbuffer_as_string(raptor_stringbuffer* stringbuffer);
RAPTOR_API size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer);
RAPTOR_API int raptor_stringbuffer_copy_to_string(raptor_stringbuffer* stringbuffer, unsigned char *string, size_t length);
typedef int (*raptor_iostream_init_func) (void *context);
typedef void (*raptor_iostream_finish_func) (void *context);
typedef int (*raptor_iostream_write_byte_func) (void *context, const int byte);
typedef int (*raptor_iostream_write_bytes_func) (void *context, const void *ptr, size_t size, size_t nmemb);
typedef void (*raptor_iostream_write_end_func) (void *context);
typedef struct {
/* optional, called at most once */
raptor_iostream_init_func init;
/* optional, called at most once */
raptor_iostream_finish_func finish;
/* methods */
raptor_iostream_write_byte_func write_byte;
raptor_iostream_write_bytes_func write_bytes;
/* optional, called at most once */
raptor_iostream_write_end_func write_end;
} raptor_iostream_handler;
RAPTOR_API raptor_iostream* raptor_new_iostream_from_handler(void *context, raptor_iostream_handler *handler);
RAPTOR_API raptor_iostream* raptor_new_iostream_to_sink(void);
RAPTOR_API raptor_iostream* raptor_new_iostream_to_filename(const char *filename);
RAPTOR_API raptor_iostream* raptor_new_iostream_to_file_handle(FILE *handle);
RAPTOR_API raptor_iostream* raptor_new_iostream_to_string(void **string_p, size_t *length_p, void *(*malloc_handler)(size_t size));
RAPTOR_API void raptor_free_iostream(raptor_iostream *iostr);
RAPTOR_API int raptor_iostream_write_bytes(raptor_iostream *iostr, const void *ptr, size_t size, size_t nmemb);
RAPTOR_API int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte);
RAPTOR_API void raptor_iostream_write_end(raptor_iostream *iostr);
RAPTOR_API int raptor_iostream_write_string(raptor_iostream *iostr, const void *string);
RAPTOR_API int raptor_iostream_write_counted_string(raptor_iostream *iostr, const void *string, size_t len);
RAPTOR_API size_t raptor_iostream_get_bytes_written_count(raptor_iostream *iostr);
RAPTOR_API int raptor_iostream_write_decimal(raptor_iostream* iostr, int integer);
RAPTOR_API int raptor_iostream_format_hexadecimal(raptor_iostream* iostr, unsigned int integer, int width);
RAPTOR_API int raptor_iostream_write_stringbuffer(raptor_iostream* iostr, raptor_stringbuffer *sb);
/* Parser and Serializer features */
RAPTOR_API raptor_feature raptor_feature_from_uri(raptor_uri *uri);
#ifdef __cplusplus
}
#endif
#endif
|