1libraptor(3)               Library Functions Manual               libraptor(3)
2
3
4

NAME

6       libraptor - Raptor RDF parser and serializer library
7

SYNOPSIS

9       #include <raptor.h>
10
11       raptor_init();
12       raptor_parser *p=raptor_new_parser("rdfxml");
13       raptor_set_statement_handler(p,NULL,print_triples);
14       raptor_uri *file_uri=raptor_new_uri("http://example.org/");
15       raptor_parse_file(p,file_uri,base_uri);
16       raptor_parse_uri(p,uri,NULL);
17       raptor_free_parser(p);
18       raptor_free_uri(file_uri);
19       raptor_finish();
20
21       cc file.c -lraptor
22

DESCRIPTION

24       The  Raptor library provides a high-level interface to a set of parsers
25       and serializers that  generate  Resource  Description  Framework  (RDF)
26       triples by parsing syntaxes or serialize the triples into syntaxes.
27
28       The  supported  parsing  syntaxes  include  RDF/XML, N-Triples, Turtle,
29       TRiG, RSS tag soup (including all RSS and Atoms), GRDDL, RDFa  and  the
30       serializing  syntaxes include RDF/XML (3 varieties), N-Triples, Turtle,
31       RSS 1.0, Atom 1.0, GraphViz DOT and RDF/JSON.  The RDF/XML  parser  can
32       use  either  expat  or  libxml  XML parsers for providing the SAX event
33       stream.  The library functions are arranged in an object-oriented style
34       with  constructors,  destructors  and method calls.  The statements and
35       error messages are delivered via callback functions.
36
37       Raptor contains a URI-reference parsing and resolving  (not  retrieval)
38       class  (raptor_uri)  sufficient  for dealing with URI-references inside
39       RDF.  This functionality is modular and can be  transparently  replaced
40       with another existing and compatible URI implementation.
41
42       It also provides a URI-retrieval class (raptor_www) for wrapping exist‐
43       ing library such as libcurl, libxml2 or BSD libfetch that provides full
44       or  partial  retrieval  of data from URIs and an I/O stream abstraction
45       (raptor_iostream) for supportin serializing to a variety of outputs.
46
47       Raptor uses Unicode strings for RDF literals  and  URIs  and  preserves
48       them  throughout the library.  It uses the UTF-8 encoding of Unicode at
49       the API for passing in or returning Unicode strings.   It  is  intended
50       that  the  preservation of Unicode for URIs will support International‐
51       ized Resource Identifiers (IRIs) which are still under development  and
52       standardisation.
53

LIBRARY INITIALISATION AND CLEANUP

55       raptor_init()
56
57       raptor_finish()
58              Initialise and cleanup the library.  These must be called before
59              any raptor class such as raptor_parser, raptor_uri is created or
60              used.   Note:  as  of  1.4.19 these are wrappers around a static
61              instance of the new raptor_world class.  In Raptor 2.0 this ini‐
62              tialisation and cleanup method will be removed.
63
64       void   raptor_set_libxslt_security_preferences(void   *security_prefer‐
65       ences)
66              Set libxslt security preferences object.
67
68       void raptor_set_libxml_flags(int flags)
69              Set     libxml     flags     from     the     choices:      RAP‐
70              TOR_LIBXML_FLAGS_GENERIC_ERROR_SAVE:   save/restore  the  libxml
71              generic    error    handler    when     parsing     and     RAP‐
72              TOR_LIBXML_FLAGS_STRUCTURED_ERROR_SAVE:  save/restore the libxml
73              structured error handler when parsing.
74

PARSER CLASS

76       This class provides the functionality  of  turning  syntaxes  into  RDF
77       triples - RDF parsing.
78

PARSER CONSTRUCTORS

80       raptor_parser* raptor_new_parser(name)
81              Create  a new raptor parser object for the parser with name name
82              currently either "rdfxml", "turtle" or  "rss-tag-soup"  for  the
83              RSS Tag Soup parser.
84
85       raptor_parser*   raptor_new_parser_for_content(raptor_uri  *uri,  const
86       char  *mime_type,  const  unsigned  char  *buffer,  size_t  len,  const
87       unsigned char *identifier)
88              Create a new raptor parser object for a syntax identified by URI
89              uri, MIME type mime_type, some initial content  buffer  of  size
90              len  or  content  with  identifier  identifier.   See  the  rap‐
91              tor_guess_parser_name description for further details.
92

PARSER DESTRUCTOR

94       void raptor_free_parser(raptor_parser *parser)
95              Destroy a Raptor parser object.
96

PARSER MESSAGE CALLBACK METHODS

98       Several methods can be registered for the parser that  return  a  vari‐
99       able-argument  message  in the style of printf(3).  These also return a
100       raptor_locator that can contain URI, file, line, column and byte counts
101       of where the message is about. This structure can be used with the rap‐
102       tor_format_locator, raptor_print_locator functions below or the  struc‐
103       tures fields directly, which are defined in raptor.h
104
105       void    raptor_set_fatal_error_handler(raptor_parser*    parser,   void
106       *user_data, raptor_message_handler handler)
107              Set the parser fatal error handler callback.
108
109       void raptor_set_error_handler(raptor_parser* parser,  void  *user_data,
110       raptor_message_handler handler)
111              Set the parser non-fatal error handler callback.
112
113       void raptor_set_warning_handler(raptor_parser* parser, void *user_data,
114       raptor_message_handler handler)
115              Set the parser warning message handler callback.
116
117       raptor_set_namespace_handler(raptor_parser*  parser,  void*  user_data,
118       raptor_namespace_handler handler)
119              Set the namespace declaration handler callback.
120

PARSER STATEMENT CALLBACK METHOD

122       The parser allows the registration of a callback function to return the
123       statements to the application.
124
125       void    raptor_set_statement_handler(raptor_parser*    parser,     void
126       *user_data, raptor_statement_handler handler)
127              Set  the  statement  callback function for the parser.  The rap‐
128              tor_statement structure is  defined  in  raptor.h  and  includes
129              fields  for  the  subject,  predicate,  object of the statements
130              along with their types and for literals, language and datatype.
131

PARSER PARSING METHODS

133       These methods perform the entire parsing  in  one  method.   Statements
134       warnings,  errors  and  fatal  errors  are delivered via the registered
135       statement, error etc. handler functions.
136
137       In both of these methods, the base URI  is  required  for  the  RDF/XML
138       parser  (name  "rdfxml")  and  Turtle  parser  (name "turtle").  The N-
139       Triples parser (name "ntriples") or RSS Tag Soup parser (name "rss-tag-
140       soup") do not use this.
141
142       int  raptor_parse_file(raptor_parser*  parser,   raptor_uri  *uri, rap‐
143       tor_uri *base_uri)
144              Parse the given filename (a URI like file:filename) according to
145              the optional base URI base_uri.  If uri is NULL, read from stan‐
146              dard input and base_uri is then required.
147
148       int raptor_parse_file_stream(raptor_parser* parser, FILE* stream, const
149       char* filename, raptor_uri *base_uri)
150              Parse  the  given  C  FILE*  stream  according  to  the base URI
151              base_uri (required).  filename is optional and if given, is used
152              for error messages via the raptor_locator structure.
153
154       int  raptor_parse_uri(raptor_parser*  parser,   raptor_uri*  uri,  rap‐
155       tor_uri *base_uri)
156              Parse the URI according to the base URI base_uri, or NULL if not
157              needed.   If no base URI is given, the uri is used.  This method
158              depends on the  raptor_www  subsystem  (see  WWW  Class  section
159              below)  and  an existing underlying URI retrieval implementation
160              such as libcurl, libxml or BSD libfetch to retrieve the content.
161

PARSER CHUNKED PARSING METHODS

163       These methods perform the parsing  in  parts  by  working  on  multiple
164       chunks  of  memory  passed  by  the  application.  Statements warnings,
165       errors and fatal errors are delivered  via  the  registered  statement,
166       error etc. handler functions.
167
168       int raptor_start_parse(raptor_parser* parser, const char *uri)
169              Start  a  parse of chunked content with the base URI uri or NULL
170              if not needed.  The base URI is required for the RDF/XML  parser
171              (name  "rdfxml")  and  Turtle  parser  (name  "turtle").  The N-
172              Triples parser (name "ntriples") or RSS Tag  Soup  parser  (name
173              "rss-tag-soup") do not use this.
174
175       int  raptor_parse_chunk(raptor_parser*  parser,   const  unsigned  char
176       *buffer, size_t len, int is_end)
177              Parse the memory at buffer of size len returning statements  via
178              the statement handler callback.  If is_end is non-zero, it indi‐
179              cates the end of the parsing stream.  This method  can  only  be
180              called after raptor_start_parse().
181

PARSER UTILITY METHODS

183       const char* raptor_get_mime_type(raptor_parser* rdf_parser)
184              Return the MIME type for the parser.
185
186       void raptor_set_parser_strict(raptor_parser *parser, int is_strict)
187              Set  the  parser to strict (is_strict not zero) or lax (default)
188              mode.  The detail of the strictness can be  controlled  by  rap‐
189              tor_set_feature.
190
191       int  raptor_set_feature(raptor_parser  *parser, raptor_feature feature,
192       int value)
193              Set a parser feature feature to a particular value.  Returns non
194              0  on failure or if the feature is unknown.  The current defined
195              parser features are:
196                Feature                                 Values
197                RAPTOR_FEATURE_ALLOW_BAGID              Boolean (non 0 true)
198                RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES  Boolean (non 0 true)
199                RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES   Boolean (non 0 true)
200                RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST  Boolean (non 0 true)
201                RAPTOR_FEATURE_ASSUME_IS_RDF            Boolean (non 0 true)
202                RAPTOR_FEATURE_CHECK_RDF_ID             Boolean (non 0 true)
203                RAPTOR_FEATURE_HTML_LINK                Boolean (non 0 true)
204                RAPTOR_FEATURE_HTML_TAG_SOUP            Boolean (non 0 true)
205                RAPTOR_FEATURE_MICROFORMATS             Boolean (non 0 true)
206                RAPTOR_FEATURE_NON_NFC_FATAL            Boolean (non 0 true)
207                RAPTOR_FEATURE_NORMALIZE_LANGUAGE       Boolean (non 0 true)
208                RAPTOR_FEATURE_NO_NET                   Boolean (non 0 true)
209                RAPTOR_FEATURE_RELATIVE_URIS            Boolean (non 0 true)
210                RAPTOR_FEATURE_SCANNING                 Boolean (non 0 true)
211                RAPTOR_FEATURE_WARN_OTHER_PARSETYPES    Boolean (non 0 true)
212                RAPTOR_FEATURE_WWW_TIMEOUT              Integer
213                RAPTOR_FEATURE_WWW_HTTP_CACHE_CONTROL   String
214                RAPTOR_FEATURE_WWW_HTTP_USER_AGENT      String
215
216       If the allow_bagid feature is true  (default  true)  then  the  RDF/XML
217       parser  will  support the rdf:bagID attribute that was removed from the
218       RDF/XML language when it was revised.  This support may be  removed  in
219       future.
220
221       If the allow_non_ns_attributes feature is true (default true), then the
222       RDF/XML parser will allow non-XML namespaced attributes to be  accepted
223       as well as rdf: namespaced ones.  For example, 'about' and 'ID' will be
224       interpreted as if they were rdf:about and rdf:ID respectively.
225
226       If the allow_other_parsetypes feature is true (default true)  then  the
227       RDF/XML  parser  will  allow  unknown parsetypes to be present and will
228       pass them on to the user.  Unimplemented at present.
229
230       If the allow_rdf_type_rdf_list feature is true (default false) then the
231       RDF/XML parser will generate the idList rdf:type rdf:List triple in the
232       handling of rdf:parseType="Collection".  This triple was removed during
233       the revising of RDF/XML after collections were initially added.
234
235       If  the assume_is_rdf feature is true (default false), then the RDF/XML
236       parser will assume the content is RDF/XML,  not  require  that  rdf:RDF
237       root element, and immediately interpret the content as RDF/XML.
238
239       If  the  check_rdf_id feature is true (default true) then rdf:ID values
240       will be checked for duplicates and cause an error if found.
241
242       if the  html_link  feature  is  true  (default  true),  look  for  head
243       &lt;link&gt; to type rdf/xml for GRDDL parser
244
245       If  the  html_tag_soup  feature  is true (default true), use a lax HTML
246       parser if an XML parser fails when read HTML for GRDDL parser.
247
248       If the microformats feature is true (default true), look for  microfor‐
249       mats for GRDDL parser.
250
251       If  the non_nfc_fatal feature is true (default false) then illegal Uni‐
252       code Normal Form C in literals will give a fatal  error,  otherwise  it
253       gives a warning.
254
255       If  the normalize_language feature is true (default true) then XML lan‐
256       guage values such as from xml:lang will be normalized to lowercase.
257
258       If the no_net feature is true (default false) then network requests are
259       denied.
260
261       If  the  scanning  feature  is  true  (default false), then the RDF/XML
262       parser will look for embedded rdf:RDF elements inside the XML  content,
263       and not require that the XML start with an rdf:RDF root element.
264
265       If  the www_timeout feature is set to an integer larger than 0, it sets
266       the timeout in seconds for internal WWW  URI  requests  for  the  GRDDL
267       parser.
268
269       If the www_http_cache_control feature is set to a string value (default
270       none), it is sent as the value of the  HTTP  Cache-Control:  header  in
271       requests.
272
273       If the www_http_user_agent feature is set to a string value, it is sent
274       as the value of the HTTP User-Agent: header in requests.
275
276       raptor_parser_set_feature_string(raptor_parser *parser,  raptor_feature
277       feature, const unsigned char *value)
278              Set  a  parser  feature  feature  to  a particular string value.
279              Returns non 0 on failure or if the feature is unknown.  The cur‐
280              rent defined parser features are given in raptor_set_feature and
281              at present only take integer values. If an integer value feature
282              is  set  with  this function, value is interpreted as an integer
283              and then that value is used.
284
285       int raptor_get_feature(raptor_parser* parser, raptor_feature feature)
286              Get parser feature integer values.  The allowed  feature  values
287              and types are given under raptor_features_enumerate.
288
289       const   unsigned  char*  raptor_parser_get_feature_string(raptor_parser
290       *parser, raptor_feature feature)
291              Get parser feature string values. The allowed feature values and
292              types are given under raptor_features_enumerate.
293
294       unsigned int raptor_get_feature_count(void)
295              Get  the  count  of  features  defined.  Prefered to the compile
296              time-only symbol RAPTOR_FEATURE_LAST which returns  the  maximum
297              value, not the count.  Added raptor_get_need_base_uri
298
299       int raptor_feature_value_type(const raptor_feature feature)
300              Get a raptor feature value tyype - integer or string.
301
302       raptor_locator* raptor_get_locator(raptor_parser* rdf_parser)
303              Return  the  current raptor_locator object for the parser.  This
304              is a public structure defined  in  raptor.h  that  can  be  used
305              directly, or formatted via raptor_print_locator.
306
307       void raptor_get_name(raptor_parser *parser)
308              Return the string short name for the parser.
309
310       void raptor_get_label(raptor_parser *parser)
311              Return a string label for the parser.
312
313       void           raptor_set_default_generate_id_parameters(raptor_parser*
314       rdf_parser, char *prefix, int base)
315              Control the default method for generation of IDs for blank nodes
316              and  bags.  The method uses a short string prefix and an integer
317              base to generate the identifier which is not guaranteed to be  a
318              strict  concatenation.   If prefix is NULL, the default is used.
319              If base is less than 1, it is initialised to 1.
320
321       void   raptor_set_generate_id_handler(raptor_parser*    parser,    void
322       *user_data, raptor_generate_id_handler handler)
323              Allow full customisation of the generated IDs by setting a call‐
324              back handler and associated user_data that is called whenever  a
325              blank  node  or bag identifier is required.  The memory returned
326              is deallocated inside raptor.  Some systems require this  to  be
327              allocated  inside  the  same  library,  in  which  case the rap‐
328              tor_alloc_memory function may be useful.
329
330       void    raptor_parser_set_uri_filter(raptor_parser*    parser,     rap‐
331       tor_uri_filter_func filter, void* user_data)
332              Set  the  URI  filter  function filter for URIs retrieved during
333              parsing by the the raptor_parser.
334
335       int raptor_get_need_base_uri(raptor_parser* rdf_parser)
336              Get a boolean whether this parser needs  a  base  URI  to  start
337              parsing.
338
339       unsigned   char*  raptor_parser_generate_id(raptor_parser*  rdf_parser,
340       raptor_genid_type type)
341              Generate  an  ID  for  a  parser  of  type  type,  either   RAP‐
342              TOR_GENID_TYPE_BNODEID  or  RAPTOR_GENID_TYPE_BAGID.   This uses
343              any configuration set by raptor_set_generate_id_handler.
344
345       void raptor_set_graph_handler(raptor_parser* parser,  void*  user_data,
346       raptor_graph_handler handler)
347              Set the graph handler callback.
348
349       raptor_world* raptor_parser_get_world(raptor_parser* rdf_parser)
350              Get the world object for the given rdf_parser.
351

PARSER UTILITY FUNCTIONS

353       int  raptor_parsers_enumerate(const  unsigned  int  counter, const char
354       **name, const char **label)
355              Return the parser name/label for a parser with a  given  integer
356              counter,  returning  non-zero  if  no such parser at that offset
357              exists.  The counter should start from 0 and be incremented by 1
358              until the function returns non-zero.
359
360       int  raptor_syntaxes_enumerate(const  unsigned  int counter, const char
361       **name, const char **label, const char **mime_type, const unsigned char
362       **uri-string)
363              Return  the  name, label, mime type or URI string (all optional)
364              for a parser syntax with a given integer counter, returning non-
365              zero  if  no  such  syntax  parser  at  that offset exists.  The
366              counter should start from 0 and be incremented by  1  until  the
367              function returns non-zero.
368
369       int  raptor_features_enumerate(const raptor_feature feature, const char
370       **name, raptor_uri **uri, const char **label)
371              Return the name, URI, string label (all optional) for  a  parser
372              feature, returning non-zero if no such feature exists.
373
374       Raptor features have URIs that are constructed from the URI http://fea
375       ture.librdf.org/raptor- and the name so for example feature  scanForRDF
376       has URI http://feature.librdf.org/raptor-scanForRDF
377
378       int raptor_syntax_name_check(const char *name)
379              Check name is a known syntax name.
380
381       const   char*   raptor_guess_parser_name(raptor_uri  *uri,  const  char
382       *mime_type, const unsigned char *buffer,  size_t  len,  const  unsigned
383       char *identifier)
384              Guess  a  parser  name  for a syntax identified by URI uri, MIME
385              type mime_type, some initial content buffer of size len or  with
386              content  identifier  identifier.   All  of  these parameters are
387              optional and only used if not NULL.  The  parser  is  chosen  by
388              scoring the hints that are given.
389
390       raptor_feature raptor_feature_from_uri(raptor_uri *uri)
391              Turn  a  URI  uri into a raptor feature identifier, or <0 if the
392              feature  is  unknown.   The  URIs  are  described   below   rap‐
393              tor_set_feature.
394

STATEMENT UTILITY FUNCTIONS

396       int  raptor_statement_compare(const  raptor_statement  *s1,  const rap‐
397       tor_statement *s2)
398              Compare two statements and return an ordering between them.
399
400       void raptor_print_statement(const  raptor_statement*  const  statement,
401       FILE *stream)
402              Print a raptor statement object in a simple format for debugging
403              only.  The format of this output is not guaranteed to remain the
404              same between releases.
405
406       void  raptor_print_statement_as_ntriples(const raptor_statement* state‐
407       ment, FILE *stream)
408              Print a raptor statement object in N-Triples format,  using  all
409              the    escapes    as    defined   in   http://www.w3.org/TR/rdf-
410              testcases/#ntriples                   ⟨http://www.w3.org/TR/rdf-
411              testcases/#ntriples⟩
412
413       raptor_statement_part_as_counted_string(const  void *term, raptor_iden‐
414       tifier_type type, raptor_uri*  literal_datatype,  const  unsigned  char
415       *literal_language, size_t* len_p)
416
417       char*  raptor_statement_part_as_string(const void *term, raptor_identi‐
418       fier_type type, raptor_uri* literal_datatype, const unsigned char *lit‐
419       eral_language)
420              Turns  part of raptor statement into N-Triples format, using all
421              the   escapes   as    defined    in    http://www.w3.org/TR/rdf-
422              testcases/#ntriples                   ⟨http://www.w3.org/TR/rdf-
423              testcases/#ntriples⟩ The part (subject,  predicate,  object)  of
424              the  raptor_statement  is passed in as term, the part type (sub‐
425              ject_type, predicate_type, object_type) is passed  in  as  type.
426              When  the  part  is  a  literal,  the  literal_datatype and lit‐
427              eral_language  fields   are   set,   otherwise   NULL   (usually
428              object_datatype, object_literal_language).
429
430              If  raptor_statement_part_as_counted_string  is used, the length
431              of the returned string is stored in *len_p if not NULL.
432

LOCATOR UTILITY FUNCTIONS

434       int raptor_format_locator(char *buffer, size_t length,  raptor_locator*
435       locator)
436              This method takes a raptor_locator object as passed to an error,
437              warning or other handler callback and formats it into the buffer
438              of  size  length bytes.  If buffer is NULL or length is insuffi‐
439              cient for the size of the formatted locator, returns the  number
440              of additional bytes required in the buffer to write the locator.
441
442              In particular, if this form is used:
443                length=raptor_format_locator(NULL,  0, locator) it will return
444              in length the size of a buffer that can be allocated for locator
445              and a second call will perform the formatting:
446                raptor_format_locator(buffer, length, locator)
447
448
449       void raptor_print_locator(FILE *stream, raptor_locator* locator)
450              This method takes a raptor_locator object as passed to an error,
451              warning or other handler callback, formats and prints it to  the
452              given stdio stream.
453
454       int raptor_locator_line(raptor_locator *locator)
455              Returns  the  line  number  in  a locator structure or <0 if not
456              available.
457
458       int raptor_locator_column(raptor_locator *locator)
459              Returns the column number in a locator structure or  <0  if  not
460              available.
461
462       int raptor_locator_byte(raptor_locator *locator)
463              Returns  the  byte  offset  in  a locator structure or <0 if not
464              available.
465
466       const char * raptor_locator_file(raptor_locator *locator)
467              Returns the filename in a  locator  structure  or  NULL  if  not
468              available.  Note the returned pointer is to a shared string that
469              must be copied if needed.
470
471       const char * raptor_locator_uri(raptor_locator *locator)
472              Returns the URI string in a locator structure  or  NULL  if  not
473              available.   Note this does not return a raptor_uri* pointer and
474              the returned pointer is to a shared string that must  be  copied
475              if needed.
476

N-TRIPLES UTILITY FUNCTIONS

478       void  raptor_print_ntriples_string(FILE*  stream,  const  char* string,
479       const char delim)
480              This is a standalone  function  that  prints  the  given  string
481              according  to  N-Triples  escaping rules, expecting to be termi‐
482              nated by delimiter delim which is usually either ', " or <.   If
483              a null delimiter \0 is given, no extra escaping is performed.
484
485       int raptor_iostream_write_string_ntriples(raptor_iostream *iostr, const
486       unsigned char *string, size_t len, const char delim)
487              Write an N-Triples  encoded  version  of  the  given  string  to
488              iostream iostr.  If delim is given, that is the ending delimeter
489              of the encoded string and it will be escaped in  the  output  as
490              appropriate.   Useful  delim  values  are ', " and >.  If a null
491              delimiter \0 is given, no extra escaping is performed.
492
493       int raptor_iostream_write_string_python(raptor_iostream  *iostr,  const
494       unsigned char *string, size_t len, const char delim, int flags)
495              Write  string  encoded to an iostream according to the delimeter
496              delim and encoding flags.  The  flag  value  selects  formatting
497              according to the appropriate Python-related languages such as N-
498              Triples (0), Turtle (1), Turtle long  quoted  string  (2),  JSON
499              (3).
500
501       void  raptor_iostream_write_statement_ntriples(raptor_iostream*  iostr,
502       const raptor_statement *statement)
503              Write an  N-Triples  encoded  version  of  the  raptor_statement
504              statement to iostream iostr.
505
506       void  raptor_iostream_write_string_turtle(raptor_iostream* iostr, const
507       unsigned char* string, size_t len)
508              DEPRECATED in 1.4.17 -  use  raptor_iostream_write_string_python
509              instead.   Write  an UTF-8 string of length len using the Turtle
510              "longString" triple quoting format to the iostream iostr.
511
512       const char*  raptor_ntriples_term_as_string  (raptor_ntriples_term_type
513       term)
514              Deprecated, for internal use.
515

XML UTILITY FUNCTIONS

517       int  raptor_xml_any_escape_string(const  unsigned  char* string, size_t
518       len, unsigned char* buffer, size_t length, char quote, int xml_version,
519       raptor_simple_message_handler error_handler, void* error_data)
520
521       int  raptor_xml_escape_string(const  unsigned char *string, size_t len,
522       unsigned char *buffer, size_t length, char  quote,  raptor_message_han‐
523       dler error_handler, void *error_data)
524              Apply  the  XML  escaping  rules to the string given in (string,
525              len) into the buffer of size length.  If  quote  is  given,  the
526              escaped  content  is  for  an  XML attribute and the appropriate
527              quote character XML element content (CDATA).   The error_handler
528              method  along with error_data allow error reporting to be given.
529              If buffer is NULL, returns the size of the  buffer  required  to
530              escape.   Otherwise the return value is the number of bytes used
531              or <0 on failure.
532
533              When an xml_version argument is present and has a value 10  (XML
534              1.0)  or  11  (XML  1.1) then that version is used.  The default
535              with no argument is to generate XML 1.0.
536
537       int       raptor_iostream_write_xml_any_escaped_string(raptor_iostream*
538       iostr,  const  unsigned  char*  string,  size_t  len,  char  quote, int
539       xml_version,   raptor_simple_message_handler    error_handler,    void*
540       error_data)
541
542       int   raptor_iostream_write_xml_escaped_string(raptor_iostream*  iostr,
543       const unsigned char *string, size_t len, char quote, raptor_simple_mes‐
544       sage_handler error_handler, void *error_data)
545              Write  an  XML-escaped  version  of the string given in (string,
546              len) to iostream iostr.  If quote is given, the escaped  content
547              is  for  an XML attribute and the appropriate quote character is
548              used,  otherwise  it  is  XML  element  content  (CDATA).    The
549              error_handler method along with error_data allow error reporting
550              to be given.
551
552              When an xml_version argument is present and has a value 10  (XML
553              1.0)  or  11  (XML  1.1) then that version is used.  The default
554              with no argument is to generate XML 1.0.
555
556       int raptor_xml_name_check(const unsigned char *string,  size_t  length,
557       int xml_version)
558              Check  that the given string of length bytes is a legal XML name
559              according to XML 1.0 or XML 1.1.  xml_version is set to 10 or 11
560              respectively.  Returns non-zero if the name is legal.
561

MEMORY UTILITY FUNCTIONS

563       void raptor_free_memory(void *ptr)
564              Free  memory allocated inside raptor.  Some systems require mem‐
565              ory allocated  in  a  library  to  be  deallocated  inside  that
566              library.   This  function  can be used in that situation to free
567              memory allocated by raptor, such as the result of the _to_ meth‐
568              ods that return allocated memory such as raptor_uri_to_filename,
569              raptor_uri_to_string, raptor_uri_to_relative_counted_uri_string,
570              raptor_uri_to_relative_uri_string      or      raptor_new_names‐
571              pace_parts_from_string.
572
573       void* raptor_alloc_memory(size_t size)
574              Allocate memory inside the raptor library.  Some systems require
575              memory  allocated  in  a  library  to be deallocated inside that
576              library.  This function can be used in that situation  to  allo‐
577              cate memory for raptor to free later, such as inside the handler
578              function  declared  with  raptor_set_generate_id_handler   which
579              returns new memory.
580
581       void* raptor_calloc_memory(size_t nmemb, size_t size)
582              Allocate  zeroed  array  of  items  inside raptor.  Some systems
583              require memory allocated in a library to be  deallocated  inside
584              that  library.   This  function can be used in that situation to
585              clear an array of allocated memory for raptor to use, for  free‐
586              ing  later,  such  as  inside the handler function declared with
587              raptor_set_generate_id_handler which returns new memory.
588

UNICODE UTILITY FUNCTIONS

590       int raptor_unicode_char_to_utf8(raptor_unichar c, unsigned  char  *out‐
591       put)
592              Turn  a  Unicode  character  into UTF8 bytes in output of size c
593              bytes which must be of sufficient size.  Returns the  number  of
594              bytes encoded or <0 on failure.
595
596       int  raptor_utf8_to_unicode_char(raptor_unichar *output, const unsigned
597       char *input, int length)
598              Decode a sequence UTF8 bytes in input of size length into a Uni‐
599              code  character  in output returning the number of bytes used or
600              <0 on failure.
601
602       int raptor_utf8_check(const unsigned char *string, size_t length)
603              Check that a given string is legal UTF-8 encoding  and  includes
604              only  legal  Unicode  characters  U+0  to  U+0x10ffff inclusive.
605              Returns non-0 if the string is good.
606
607       int raptor_unicode_is_xml11_namestartchar(raptor_unichar c)
608
609       int raptor_unicode_is_xml10_namestartchar(raptor_unichar c)
610
611       int raptor_unicode_is_xml11_namechar(raptor_unichar c)
612
613       int raptor_unicode_is_xml10_namechar(raptor-unichar c)
614              Check that given Unicode characters are allowed as  XML  1.0  or
615              XML  1.0  names  -  either  as  the starting character (*_names‐
616              tartchar) or continuing character (*_namechar).   Returns  non-0
617              if the character is allowed.
618

ERROR UTILITY FUNCTIONS

620       void raptor_error_handlers_init(raptor_error_handlers* error_handlers)
621              Initialise  an error_handlers structure after the log level han‐
622              dlers and user data pointers have been set.
623

MISCELLANEOUS UTILITY FUNCTIONS

625       char* raptor_vsnprintf(const char *message, va_list arguments)
626              Compatibility wrapper around vsnprintf.
627

STATIC VARIABLES

629       There are several read-only static variables in the raptor library:
630
631       const char * const raptor_short_copyright_string
632              Short copyright string, suitable for one line.
633
634       const char * const raptor_copyright_string
635              Full copyright over several lines including URLs.
636
637       const char * const raptor_version_string
638              The version as a string
639
640       const unsigned int raptor_version_major
641              The major version number as an integer.
642
643       const unsigned int raptor_version_minor
644              The minor version number as an integer.
645
646       const unsigned int raptor_version_release
647              The release version number as an integer.
648
649       const unsigned int raptor_version_decimal
650              The version number as a single decimal.
651
652       const char * const raptor_license_string
653              The license string over several lines including URLs.
654
655       const char * const raptor_home_url_string
656              The home page URL as a string.
657

SERIALIZER CLASS

659       This class provides the functionality of turning RDF triples into  syn‐
660       taxes - RDF serializing.
661

SERIALIZER CONSTRUCTOR

663       raptor_serializer* raptor_new_serializer(const char *name)
664              Create  a  new  raptor serializer object for the serializer with
665              name name currently either "rdfxml" or "ntriples".  or "rss-1.0"
666              for the RSS 1.0 serializer.
667

SERIALIZER DESTRUCTOR

669       void raptor_free_serializer(raptor_serializer* rdf_serializer)
670              Destroy a Raptor serializer object.
671

SERIALIZER SERIALIZING METHODS

673       int   raptor_serialize_start(raptor_serializer*   rdf_serializer,  rap‐
674       tor_uri *uri, raptor_iostream *iostream)
675              Start to serialize content using the given iostream to write  to
676              with  optional  base  URI uri. The iostream becomes owned by the
677              serializer object and is destroyed at  the  end  of  serializing
678              when raptor_serialize_end() is called.  Note that  some syntaxes
679              may refuse to serialize without a base URI, such as RDF/XML.
680
681       int  raptor_serialize_start_to_iostream(raptor_serializer*  rdf_serial‐
682       izer, raptor_uri* uri, raptor_iostream* iostream)
683              Start  to serialize content using the given iostream to write to
684              with optional base URI uri.  The iostream does NOT become  owned
685              by the serializer object and the caller may continue to write to
686              it after serializing is finished.  Note that some  syntaxes  may
687              refuse to serialize without a base URI, such as RDF/XML.
688
689       int  raptor_serialize_start_to_filename(raptor_serializer*  rdf_serial‐
690       izer, const char *filename)
691              Start to serialize content to the file filename which is  opened
692              for writing. The base URI is calculated from the file name.
693
694       int raptor_serialize_start_to_string(raptor_serializer* rdf_serializer,
695       raptor_uri *uri, void **string_p, size_t *length_p)
696              Start to serialize content to a string.  string_p must point  to
697              a  void*  pointer that will be used at the end of serializing to
698              store the newly allocated string.  length_p if not NULL, it will
699              be  used to store the length of the new string.  The serializing
700              is done with optional base URI uri  however  some  syntaxes  may
701              refuse to serialize without a base URI, such as RDF/XML.
702
703       int  raptor_serialize_start_to_file_handle(raptor_serializer* rdf_seri‐
704       alizer, raptor_uri *uri, FILE *handle)
705              Start to serialize content to the already open  C  Standard  I/O
706              FILE* handle with the base URI uri, which is optional and may be
707              NULL.  Note that some syntaxes may refuse to serialize without a
708              base URI, such as RDF/XML.
709
710       int raptor_serialize_statement(raptor_serializer* rdf_serializer, const
711       raptor_statement *statement)
712              Serialize a single statement using the serializer.
713
714       int raptor_serialize_end(raptor_serializer* rdf_serializer)
715              End the serializing.  This may close and delete  resources  used
716              in  serializing.  No more calls to raptor_serialize_statement or
717              raptor_serialize_end may be done at this point.
718
719       raptor_iostream*       raptor_serializer_get_iostream(raptor_serializer
720       *serializer)
721              Return a pointer to the raptor_iostream* used by the serializer.
722
723       int raptor_serializer_set_namespace(raptor_serializer* serializer, rap‐
724       tor_uri *uri, const char *prefix)
725              Set a suggested namespace URI/prefix mapping for use in  serial‐
726              izing.
727

SERIALIZER UTILITY METHODS

729       void raptor_serializer_set_error_handler(raptor_serializer* serializer,
730       void *user_data, raptor_message_handler handler)
731              Set the serializer non-fatal error handler callback.
732
733       void  raptor_serializer_set_warning_handler(raptor_serializer*  serial‐
734       izer, void *user_data, raptor_message_handler handler)
735              Set the serializer warning message handler callback.
736
737       raptor_locator*        raptor_serializer_get_locator(raptor_serializer*
738       rdf_serializer)
739              Return the current raptor_locator  object  for  the  serializer.
740              This  is a public structure defined in raptor.h that can be used
741              directly, or formatted via raptor_print_locator.
742
743       int raptor_serializer_set_feature(raptor_serializer  *serializer,  rap‐
744       tor_feature feature, int value)
745              Set a serializer feature feature to a particular value.  Returns
746              non 0 on failure or if the  feature  is  unknown.   The  current
747              defined serializer features are:
748                Feature                                 Values
749                RAPTOR_FEATURE_RELATIVE_URIS            Boolean (non 0 true)
750                RAPTOR_FEATURE_WRITE_BASE_URI           Boolean (non 0 true)
751                RAPTOR_FEATURE_START_URI                URI String
752                RAPTOR_FEATURE_BNODE_BORDER             String
753                RAPTOR_FEATURE_BNODE_FILL               String
754                RAPTOR_FEATURE_JSON_CALLBACK            String
755                RAPTOR_FEATURE_JSON_EXTRA_DATA          String
756                RAPTOR_FEATURE_LITERAL_BORDER           String
757                RAPTOR_FEATURE_LITERAL_FILL             String
758                RAPTOR_FEATURE_RESOURCE_BORDER          String
759                RAPTOR_FEATURE_RESOURCE_FILL            String
760                RAPTOR_FEATURE_RSS_TRIPLES              String
761                RAPTOR_FEATURE_ATOM_ENTRY_URI           String
762
763
764       If  the relative_uris feature is true (default false) then when serial‐
765       ising, preference is given to generating relative URIs where possible.
766
767       If the write_base_uri feature is true (default  true)  then  the  atom,
768       rdfxml,  rdfxml-abbrev  and  turtle  serializers will write an @base or
769       xml:base directive in the output.
770
771       If the start_uri feature is set to a URI it is used by  the  serializer
772       to start serializing from.
773
774       If  the  bnode_border feature is set, the DOT serializer uses it as the
775       bnode border colour.
776
777       If the bnode_fill feature is set, the DOT serializer  uses  it  as  the
778       bnode fill colour.
779
780       If the json_callback feature is set, the JSON serializers use it as the
781       name of the callback to wrap the outer JSON object.
782
783       If the json_extra_data feature is set, the JSON serializers use  it  as
784       extra data inside the outer JSON object.
785
786       If the literal_border feature is set, the DOT serializer uses it as the
787       literal border colour.
788
789       If the literal_fill feature is set, the DOT serializer uses it  as  the
790       literal fill colour.
791
792       If  the  resource_border  feature is set, the DOT serializer uses it as
793       the resource border colour.
794
795       If the resource_fill feature is set, the DOT serializer uses it as  the
796       resource fill colour.
797
798       If  the  rss_triples  feature  is  set  to the string "rdf-xml" for the
799       rss-1.0 serializer or "atom-triples" for the atom serializer, it writes
800       extra rdf triples into the serialized output.
801
802       If  the  atom_entry_uri  feature  is set to a URI string, it is used to
803       trigger generation of an atom entry document for the atom serializer.
804
805       int raptor_serializer_get_feature(raptor_serializer*  serializer,  rap‐
806       tor_feature feature)
807              Get  serializer  features, the allowed feature values are avail‐
808              able
809
810       raptor_world* raptor_serializer_get_world(raptor_serializer*  rdf_seri‐
811       alizer)
812              Get the world object for the given rdf_serializer.
813

SERIALIZER UTILITY FUNCTIONS

815       int raptor_serializers_enumerate(const unsigned int counter, const char
816       **name, const char **label, const char **mime_type, const unsigned char
817       **uri_string)
818              Return  the  serializer name/label for a serializer with a given
819              integer counter, returning non-zero if no such  parser  at  that
820              offset  exists.   The  counter should start from 0 and be incre‐
821              mented by 1 until the function returns non-zero.
822
823       int raptor_serializer_syntax_name_check(const char *name)
824              Check name is a known serializer syntax name.
825

URI CLASS

827       Raptor has a raptor_uri class must be used for manipulating and passing
828       URI references.  The default internal implementation uses char* strings
829       for URIs, manipulating them and constructing them.  This URI  implemen‐
830       tation  can be replaced by any other that provides the equivalent func‐
831       tionality, using the raptor_uri_set_handler function.
832

URI CONSTRUCTORS

834       There a several constructors for raptor_uri to build  them  from  char*
835       strings and existing raptor_uri objects.
836
837       raptor_uri* raptor_new_uri(const unsigned char* uri_string)
838              Create a raptor URI from a string URI-reference uri_string.
839
840       raptor_uri*  raptor_new_uri_from_uri_local_name(raptor_uri*  uri, const
841       unsigned char* local_name)
842              Create a raptor URI from a string URI-reference local_name rela‐
843              tive  to an existing URI-reference.  This performs concatenation
844              of the local_name to the uri and not  relative  URI  resolution,
845              which  is  done by the raptor_new_uri_relative_to_base construc‐
846              tor.
847
848       raptor_uri* raptor_new_uri_relative_to_base(raptor_uri* base_uri, const
849       unsigned char* uri_string)
850              Create a raptor URI from a string URI-reference uri_string using
851              relative URI resolution to the base_uri.
852
853       raptor_uri* raptor_new_uri_from_id(raptor_uri* base_uri, const unsigned
854       char* id)
855              Create  a raptor URI from a string RDF ID id concatenated to the
856              base_uri base URI.
857
858       raptor_uri* raptor_new_uri_for_rdf_concept(const char* name)
859              Create a raptor URI for the RDF namespace concept name.
860
861       raptor_uri* raptor_new_uri_for_xmlbase(raptor_uri* old_uri))
862              Create a raptor URI suitable for use with xml:base  (throw  away
863              fragment)
864

URI DESTRUCTOR

866       void raptor_free_uri(raptor_uri* uri)
867              Destroy a raptor URI object.
868

URI METHODS

870       int raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2)
871              Return non-zero if the given URIs are equal.
872
873       raptor_uri* raptor_uri_copy(raptor_uri* uri)
874              Return a copy of the given raptor URI uri.
875
876       unsigned  char*  raptor_uri_as_counted_string(raptor_uri  *uri, size_t*
877       len_p)
878
879       unsigned char* raptor_uri_as_string(raptor_uri* uri)
880              Return a shared pointer to a string representation of the  given
881              raptor  URI  uri.   This  string is shared and must not be freed
882              (otherwise see the  raptor_uri_to_*  methods  below).   If  rap‐
883              tor_uri_as_counted_string  is  used,  the length of the returned
884              string is stored in *len_p if not NULL.
885
886       unsigned  char*  raptor_uri_to_counted_string(raptor_uri  *uri,  size_t
887       *len_p)
888
889       unsigned char* raptor_uri_to_string(raptor_uri *uri)
890              Return  a  to a newly alloced string representation of the given
891              raptor URI uri.  This string must be freed by the  caller  using
892              raptor_free_memory.   If  raptor_uri_to_counted_string  is used,
893              the length of the returned string is stored  in  *len_p  if  not
894              NULL.
895
896       unsigned   char*   raptor_uri_to_relative_counted_uri_string(raptor_uri
897       *base_uri, raptor_uri *reference_uri, size_t *length_p)
898
899       unsigned char* raptor_uri_to_relative_uri_string(raptor_uri  *base_uri,
900       raptor_uri *reference_uri)
901              Return  a new relative URI string of a URI reference_uri against
902              a base URI base_uri.  The returned string  must  be  freed  with
903              raptor_free_memory.  If raptor_uri_to_relative_counted_string is
904              used, the length of the returned string is stored in  *len_p  if
905              not NULL.
906
907       void raptor_uri_print(const raptor_uri* uri, FILE *stream)
908              Print URI uri to the file handle stream.
909
910       int raptor_iostream_write_uri(raptor_iostream* iostr,  raptor_uri* uri)
911              Write the raptor_uri uri to the iostream ostr.
912

URI UTILITY FUNCTIONS

914       void  raptor_uri_resolve_uri_reference  (const unsigned char* base_uri,
915       const unsigned  char*  reference_uri,  char  unsigned*  buffer,  size_t
916       length)
917              This  is  a  standalone  function that resolves the relative URI
918              reference_uri against the base URI base_uri according to the URI
919              resolution  rules  in  RFC2396.   The resulting URI is stored in
920              buffer which is of length bytes.  If this is too small, no  work
921              will be done.
922
923       char *raptor_uri_filename_to_uri_string(const unsigned char* filename)
924              This  is a standalone function that turns a local filename (Win‐
925              dows or Unix style as  appropriate  for  platform)  into  a  URI
926              string (file).
927               The  returned  string must be freed by the caller. Some systems
928              require memory allocated in a library to be  deallocated  inside
929              that library in which case raptor_free_memory may be used.
930
931       char     *raptor_uri_uri_string_to_filename(const     unsigned    char*
932       uri_string)
933
934       char    *raptor_uri_uri_string_to_filename(const     unsigned     char*
935       uri_string, unsigned char **fragment_p)
936              These  are standalone functions that turn a URI string that rep‐
937              resents a local filename (file:) into a filename, with  optional
938              URI  fragment.  If fragment_p is not NULL it points to the loca‐
939              tion to store a newly allocated string containing the  fragment.
940              The  returned strings must be freed by the caller.  Some systems
941              require memory allocated in a library to be  deallocated  inside
942              that library in which case raptor_free_memory may be used.
943
944       int raptor_uri_is_file_uri(const unsigned char* uri_string)
945              DEPRECATED  in  1.4.9.  Returns non-zero if the given URI string
946              represents a filename.  Use raptor_uri_uri_string_is_file_uri in
947              preference.
948
949       int raptor_uri_uri_string_is_file_uri(const unsigned char* uri_string)
950              Returns non-zero if the given URI string represents a filename.
951

URI CLASS IMPLEMENTATION

953       void  raptor_uri_set_handler(const  raptor_uri_handler  *handler,  void
954       *context)
955              Change the URI class implementation to the functions provided by
956              the handler URI implementation.  The context user data is passed
957              in to the handler URI implementation calls.
958
959       void raptor_uri_get_handler(raptor_uri_handler **handler,  void  **con‐
960       text)
961              Return  the  current raptor URI class implementation handler and
962              context
963
964

WWW CLASS

966       This is a small wrapper class around existing WWW libraries in order to
967       provide  HTTP  GET  or  better  URI  retrieval  for  Raptor.  It is not
968       intended to be a general purpose WWW retrieval interface.
969

WWW CLASS INITIALISATION AND CLEANUP

971       void raptor_www_init(void)
972
973       void raptor_www_finish(void)
974              Initialise or terminate  the  raptor_www  infrastructure.   rap‐
975              tor_www_init  and  raptor_finish  are  called by raptor_init and
976              raptor_finish respecitively, otherwise must be called once each.
977
978       NOTE   Several of the WWW  library  implementations  require  once-only
979              initialisation  and  termination functions to be called, however
980              raptor cannot determine whether this is already done before  the
981              library  is initialised in raptor_www_init or terminated in rap‐
982              tor_www_finish, so always performs it.  This can be  changed  by
983              raptor_www_no_www_library_init_finish.
984
985       void raptor_www_no_www_library_init_finish(void)
986              If  this  is called before raptor_www_init, it will not call the
987              underlying WWW library global initialise or terminate functions.
988              The application code must perform both operations.
989
990              For  example  with  curl, after this function is called, neither
991              curl_global_init nor curl_global_cleanup will be  called  during
992              raptor_www_init or raptor_www_finish respectively.
993

WWW CONSTRUCTORS

995       raptor_www *raptor_www_new(void)
996
997       raptor_www *raptor_www_new_with_connection(void* connection)
998              Create a raptor WWW object capable of URI retrieval.  If connec‐
999              tion is given, it must match the connection object of the under‐
1000              lying WWW implementation.  At present, this is only for libcurl,
1001              and allows you to re-use an existing curl  handle,  or  use  one
1002              which has been set up with some desired qualities.
1003

WWW DESTRUCTOR

1005       void raptor_www_free(raptor_www *www)
1006              Destroy a raptor WWW object.
1007

WWW METHODS

1009       void raptor_www_set_user_agent(raptor_www *www, const char *user_agent)
1010              Set the HTTP User-Agent header value.
1011
1012       int   raptor_www_set_http_cache_control(raptor_www*  www,  const  char*
1013       cache_control)
1014              Set the HTTP Cache-Control header value.
1015
1016       void raptor_www_set_proxy(raptor_www *www, const char *proxy)
1017              Set  the  HTTP  proxy  -  usually   a   string   of   the   form
1018              http://server:port
1019
1020       raptor_www_set_write_bytes_handler(raptor_www         *www,        rap‐
1021       tor_www_write_bytes_handler handler, void *user_data)
1022              Set the handler to  receive  bytes  written  by  the  raptor_www
1023              implementation.
1024
1025       void    raptor_www_set_content_type_handler(raptor_www    *www,    rap‐
1026       tor_www_content_type_handler handler, void *user_data)
1027              Set the handler to receive the HTTP Content-Type value,  when/if
1028              discovered during retrieval by the raptor_www implementation.
1029
1030       void raptor_www_set_http_accept(raptor_www *www, const char *value)
1031              Set  the WWW HTTP Accept: header to value.  If value is NULL, an
1032              empty header is sent.
1033
1034       void raptor_www_set_error_handler(raptor_www *www,  raptor_message_han‐
1035       dler error_handler, void *error_data)
1036              Set  the  error  handler routine for the raptor_www class.  This
1037              takes the same arguments as  the  raptor_parser  error,  warning
1038              handler methods.
1039
1040       void  raptor_www_set_uri_filter(raptor_www* www, raptor_uri_filter_func
1041       filter, void* user_data)
1042              Set the URI filter function filter for  URIs  retrieved  by  the
1043              raptor_www object.
1044
1045       void* raptor_www_get_connection(raptor_www *www)
1046              Return  the underlying WWW library connection object.  For exam‐
1047              ple, for libcurl this is the curl_handle.
1048
1049       void raptor_www_set_connection_timeout(raptor_www* www, int timeout)
1050              Set the WWW connection timeout in seconds.
1051
1052       raptor_uri* raptor_www_get_final_uri(raptor_www* www)
1053              Get the final URI from a WWW retrieval, which may include  redi‐
1054              rections.
1055

WWW ACTION METHODS

1057       int raptor_www_fetch(raptor_www *www, raptor_uri *uri)
1058              Retrieve the given URL, returning non zero on failure.
1059
1060       int  raptor_www_fetch_to_string(raptor_www  *www, raptor_uri *uri, void
1061       **string_p, size_t *length_p, void *(*malloc_handler)(size_t size))
1062              Retrieve the given URL to a string.  string_p must  point  to  a
1063              void*  pointer  that  will  be used to store the newly allocated
1064              string.  length_p if not NULL, it will  be  used  to  store  the
1065              length of the new string.
1066
1067       void raptor_www_abort(raptor_www *www, const char *reason)
1068              Abort an ongoing raptor WWW operation. Typically used within one
1069              of the raptor WWW handlers.
1070

QNAME CLASS

1072       This is a class for handling XML QNames consisting of the  pair  of  (a
1073       URI  from  a  namespace,  a local name) along with an optional value --
1074       useful for  XML  attributes.   This  is  used  with  the  raptor_names‐
1075       pace_stack  and  raptor_namespace  classes  to  handle  a stack of rap‐
1076       tor_namespace that build on raptor_qname.
1077

QNAME CONSTRUCTORS

1079       There are two  constructors  for  raptor_qname  to  build  qnames  with
1080       optional values on a stack of names.
1081
1082       raptor_qname*  raptor_new_qname(raptor_namespace_stack  *nstack,  const
1083       unsigned char *name, const  unsigned  char  *value,  raptor_simple_mes‐
1084       sage_handler error_handler, void *error_data)
1085              Create  a  raptor  QName name (a possibly :-separated name) with
1086              name to be resolved against the given  nstack  namespace  stack.
1087              An  optional  value  can be given, and if there is an error, the
1088              error_handler and error_data will be used to  invoke  the  call‐
1089              back.
1090
1091       raptor_qname* raptor_new_qname_from_namespace_local_name (raptor_names‐
1092       pace *ns, const unsigned char *local_name, const unsigned char *value)
1093              Create a raptor QName using  the  namespace  name  of  the  rap‐
1094              tor_namespace  ns  and  the  local  name  local_name, along with
1095              optional value value.  Errors are reported using the error  han‐
1096              dling and data of the namespace.
1097
1098       raptor_qname* raptor_qname_copy(raptor_qname *qname)
1099              Create  a  raptor  QName from an existing one, returning NULL on
1100              failure.
1101

QNAME DESTRUCTOR

1103       void raptor_free_qname(raptor_qname* name)
1104              Destroy a raptor qname object.
1105

QNAME METHODS

1107       int raptor_qname_equal(raptor_qname* name1, raptor_qname *name2)
1108              Return non-zero if the given QNames are equal.
1109
1110       int  raptor_iostream_write_qname(raptor_iostream*  iostr,  raptor_qname
1111       *qname)
1112              Write the raptor_qname qname to the iostream ostr.
1113
1114       const unsigned char* raptor_qname_get_local_name(raptor_qname* name)
1115              Get the local name of the QName.
1116
1117       const unsigned char* raptor_qname_get_value(raptor_qname* name)
1118              Get the value of the QName for an XML attribute QName.
1119
1120       const unsigned char* raptor_qname_get_counted_value(raptor_qname* name,
1121       size_t* length_p)
1122              Get the value fo the QName along with the length (if length_p is
1123              not NULL) for an XML attribute QName.
1124
1125       unsigned    char*   raptor_qname_to_counted_name(raptor_qname*   qname,
1126       size_t* length_p)
1127              Get the formatted QName as a newly allocated counted string  (if
1128              length_p is not NULL).
1129

QNAME UTILITY FUNCTIONS

1131       raptor_uri*  raptor_qname_string_to_uri(raptor_namespace_stack *nstack,
1132       const unsigned char *name, size_t name_len,  raptor_simple_message_han‐
1133       dler error_handler, void *error_data)
1134              Return  the  URI corresponding to the QName according to the RDF
1135              method; concatenating the namespace's name (URI) with the  local
1136              name.  Takes the same arguments as raptor_new_qname but does not
1137              create a raptor_qname object.
1138
1139       raptor_namespace* raptor_qname_get_namespace(raptor_qname* name)
1140              Return the raptor_namespace used by the QName.   Will  never  be
1141              NULL even for the default namespace in which case the URI of the
1142              returned namespace object will be NULL.
1143

NAMESPACE CLASS

1145       An XML namespace class - each entry is on a stack  and  consists  of  a
1146       name  (URI)  and  prefix.   The  prefix or the name but not both may be
1147       empty.  If the prefix is empty, it defines the default prefix.  If  the
1148       name is empty, it undefines the given prefix.
1149

NAMESPACE CONSTRUCTORS

1151       raptor_namespace*  raptor_new_namespace(raptor_namespace_stack *nstack,
1152       const unsigned char *prefix, const unsigned  char  *ns_uri_string,  int
1153       depth)
1154
1155       raptor_namespace*  raptor_new_namespace_from_uri(raptor_namespace_stack
1156       *nstack, const unsigned char *prefix, raptor_uri* ns_uri, int depth)
1157              Create a new raptor_namespace  object  on  the  given  namespace
1158              stack  nstack  with prefix prefix and namespace name either from
1159              URI string ns_uri_string or from copying URI ns_uri.
1160
1161       If prefix is NULL, it defines the URI for the default namespace prefix.
1162       If  the  namespace name (ns_uri_string or ns_uri) is NULL, it undefines
1163       the given prefix in the current scope.  Both prefix and URI may be NULL
1164       to undefine the default namespace.  depth signifies the position of the
1165       namespace on the stack; 0 is the bottom of the stack and generally  the
1166       first depth for user namespace declarations.
1167
1168       Namespaces declared on the same depth (such as on the same XML element,
1169       typically) can be handily  freed  with  raptor_namespaces_end_for_depth
1170       method on the namespace stack class.
1171

NAMESPACE DESTRUCTOR

1173       void raptor_free_namespace(raptor_namespace *ns)
1174              Destroy a raptor namespace object.
1175

NAMESPACE METHODS

1177       raptor_uri* raptor_namespace_get_uri(const raptor_namespace *ns)
1178              Return the namespace name (URI) of the namespace.
1179
1180       const unsigned char* raptor_namespace_get_prefix(const raptor_namespace
1181       *ns)
1182              Return the prefix of the namespace.
1183
1184       const  unsigned  char*  raptor_namespace_get_counted_prefix(const  rap‐
1185       tor_namespace* ns, size_t* length_p)
1186              Return  the  prefix  of  the namespace as a string with optional
1187              count stored in the variable address length_p if it is not NULL.
1188
1189       unsigned  char  *raptor_namespaces_format(const  raptor_namespace  *ns,
1190       size_t *length_p)
1191              Format  the namespace as a string and return it as a new string,
1192              returning the length of the resulting string in length_p  if  it
1193              is  not NULL.  The string format is suitable for emitting in XML
1194              to declare the namespace.
1195
1196       int   raptor_iostream_write_namespace(raptor_iostream*   iostr,    rap‐
1197       tor_namespace *ns)
1198              Write  a  formatted  namespace  declaration  like xmlns... to an
1199              iostream iostr.
1200

NAMESPACE UTILITY FUNCTIONS

1202       int raptor_namespace_copy(raptor_namespace_stack *nstack, raptor_names‐
1203       pace *ns, int new_depth)
1204              Copy the namespace from the current stack to the new one, nstack
1205              at depth new_depth.
1206
1207       int   raptor_new_namespace_parts_from_string(unsigned   char   *string,
1208       unsigned char **prefix, unsigned char **uri_string)
1209              Parse  string  with  an  XML-style  namespace  declaration  like
1210              xmlns="",  xmlns="uri",  xmlns:prefix=""  or  xmlns:prefix="uri"
1211              into  the  strings pointed to by prefix string and a uri_string.
1212              Empty  prefixes  or  namespace  names  return   NULL   pointers.
1213              Returned  strings  must  be  freed  by  the  caller  using  rap‐
1214              tor_free_memory.
1215

NAMESPACE STACK CLASS

1217       A stack of raptor_namespace objects where the namespaces on top of  the
1218       stack  have wider scope and override earlier (lower) namespace declara‐
1219       tions.  Intended to match the XML namespace declaring  semantics  using
1220       xmlns attributes.
1221

NAMESPACE STACK CONSTRUCTORS

1223       raptor_namespace_stack*        raptor_new_namespaces(raptor_uri_handler
1224       *uri_handler,    void    *uri_context,    raptor_simple_message_handler
1225       error_handler, void *error_data, int defaults)
1226
1227       int    raptor_namespaces_init(raptor_namespace_stack    *nstack,   rap‐
1228       tor_uri_handler *handler, void *context,  raptor_simple_message_handler
1229       error_handler, void *error_data, int defaults)
1230              Create  or  initialise  a new raptor_namespace_stack object with
1231              the given URI and error handlers.   raptor_namespaces_new  allo‐
1232              cates  new  memory  for  the  namespace  stack and raptor_names‐
1233              paces_init initialises an existing declared nstack, which  could
1234              be  statically  allocated.  Note that raptor_uri_get_handler can
1235              be useful to return the current raptor URI handler/context.  The
1236              defaults   argument   describes  which  default  namespaces  are
1237              declared in the empty stack.  At present, 0 is none, 1 for  just
1238              the  XML namespace and 2 is for a typical set of namespaces used
1239              for RDF, RDFS, Dublin Core, OWL, ...  that may vary over time.
1240
1241              In versions 1.4.16 or newer  this  returns  an  integer  result,
1242              non-0 on failure.
1243

NAMESPACE STACK DESTRUCTORS

1245       void raptor_free_namespaces(raptor_namespace_stack *nstack)
1246              Destroy  a namespace stack object, freeing the nstack (goes with
1247              raptor_new_namespaces).
1248
1249       void raptor_namespaces_clear(raptor_namespace_stack *nstack)
1250              Clear a statically allocated namespace stack; does not free  the
1251              nstack.  (goes with raptor_namespaces_init).
1252

NAMESPACE STACK METHODS

1254       void  raptor_namespaces_start_namespace(raptor_namespace_stack *nstack,
1255       raptor_namespace *nspace)
1256              Start the given nspace  on  the  stack,  at  the  depth  already
1257              defined.
1258
1259       int       raptor_namespaces_start_namespace_full(raptor_namespace_stack
1260       *nstack, const unsigned char *prefix, const unsigned char *nspace,  int
1261       depth)
1262              Create  a  new  raptor_namespace and start it on the stack.  See
1263              raptor_new_namespace for the meaning of the argumens.
1264
1265       void  raptor_namespaces_end_for_depth(raptor_namespace_stack   *nstack,
1266       int depth)
1267              End (and free) all namespaces on the stack at the given depth.
1268
1269       raptor_namespace*     raptor_namespaces_get_default_namespace     (rap‐
1270       tor_namespace_stack *nstack)
1271              Return the current default  raptor_namespace  of  the  namespace
1272              stack or NULL if there is none.
1273
1274       raptor_namespace* raptor_namespaces_find_namespace_by_uri(raptor_names‐
1275       pace_stack *nstack, raptor_uri *ns_uri)
1276              Find the first namespace on the stack with the given uri  ns_uri
1277              or NULL if there is none.
1278
1279       raptor_namespace *raptor_namespaces_find_namespace_by_uri(raptor_names‐
1280       pace_stack *nstack, const unsigned char *prefix, int prefix_length)
1281              Find the first namespace on the stack with the  given  namespace
1282              prefix or NULL if there is none.
1283
1284       int         raptor_namespaces_namespace_in_scope(raptor_namespace_stack
1285       *nstack, const raptor_namespace *nspace)
1286              Return non-zero if the raptor_namespace nspace  is  declared  on
1287              the stack; i.e. in scope if this is a stack of XML namespaces.
1288

NAMESPACE STACK UTILITY FUNCTIONS

1290       raptor_qname*  raptor_namespaces_qname_from_uri(raptor_namespace_stack*
1291       nstack,  raptor_uri* uri, int xml_version)
1292              Create a raptor QName from the URI uri if the URI is  squal  one
1293              of  the  namespace  URIs on the namespace stack nstack URIs con‐
1294              catenated to a legal XML name for the given XML  version.   URIs
1295              are  created  and  errors are reported using the namespace stack
1296              fields.  Fails if it cannot be legally described with any of the
1297              namespaces.
1298

SEQUENCE CLASS

1300       A  class  for  ordered  sequences of items, adding at either end of the
1301       sequence.  The method names should be familiar to Perl users.
1302

SEQUENCE CONSTRUCTOR

1304       raptor_sequence*      raptor_new_sequence(raptor_sequence_free_handler*
1305       free_handler, raptor_sequence_print_handler* print_handler)
1306              Create  a  new empty sequence, with optional handler for freeing
1307              elements (as used by raptor_free_sequence and printing out  ele‐
1308              ments (used by raptor_sequence_print).
1309

SEQUENCE DESTRUCTOR

1311       void raptor_free_sequence(raptor_sequence* seq)
1312              Destoy  a sequence object, freeing any items if the free handler
1313              was defined in the constructor.
1314

SEQUENCE METHODS

1316       int raptor_sequence_size(raptor_sequence* seq)
1317              Return the number of items in the sequence.
1318
1319       int raptor_sequence_set_at(raptor_sequence* seq, int idx, void *data)
1320              Set the sequence item at index idx to the value data,  extending
1321              it if necessary.
1322
1323       int raptor_sequence_push(raptor_sequence* seq, void *data)
1324              Add item data to the end of the sequence.
1325
1326       int raptor_sequence_shift(raptor_sequence* seq, void *data)
1327              Add item data to the start of the sequence.
1328
1329       void* raptor_sequence_get_at(raptor_sequence* seq, int idx)
1330              Get  the  sequence  item  at  index idx or NULL if no such index
1331              exists.
1332
1333       void* raptor_sequence_pop(raptor_sequence* seq)
1334              Remove and return an item from the end of the sequence, or  NULL
1335              if is empty.
1336
1337       void* raptor_sequence_unshift(raptor_sequence* seq)
1338              Remove  and  return  an  item from the start of the sequence, or
1339              NULL if is empty.
1340
1341       void  raptor_sequence_sort(raptor_sequence*  seq,   int(*compare)(const
1342       void *, const void *))
1343              Sort  the  sequence  using the given comparison function compare
1344              which is passed to qsort(3) internally.
1345
1346       int raptor_compare_strings(const void *a, const void *b)
1347              Helper function useful with raptor_sequence_sort.
1348
1349       void   raptor_sequence_set_print_handler(raptor_sequence   *seq,   rap‐
1350       tor_sequence_print_handler *print_handler)
1351              Set  the  print handler for the sequence, an alternative to set‐
1352              ting it in the constructor.
1353
1354       void raptor_sequence_print_string(char *data, FILE *fh)
1355              Helper print handler function useful for printing out  sequences
1356              of strings.
1357
1358       void raptor_sequence_print_uri(char *data, FILE *fh)
1359              Helper  print handler function useful for printing out sequences
1360              of raptor_uri* objects.
1361
1362       void raptor_sequence_print(raptor_sequence* seq, FILE* fh)
1363              Print out the sequence in a debug format to the given file  han‐
1364              dler fh.  NOTE: The exact format is not guaranteed to remain the
1365              same between releases.
1366
1367       int raptor_sequence_join(raptor_sequence* dest, raptor_sequence *src)
1368              Join two sequences moving all items from sequence src to the end
1369              of  sequence  dest.   After this operation, sequence src will be
1370              empty (zero size) but  will  have  the  same  item  capacity  as
1371              before.
1372
1373       void* raptor_sequence_delete_at(raptor_sequence* seq, int idx)
1374              Remove an item from position idx in the sequence, returning it.
1375

STRINGBUFFER CLASS

1377       A class for growing strings, small chunks at a time.
1378

STRINGBUFFER CONSTRUCTOR

1380       raptor_stringbuffer* raptor_new_stringbuffer(void)
1381              Create a new stringbuffer.
1382

STRINGBUFFER DESTRUCTOR

1384       void raptor_free_stringbuffer(raptor_stringbuffer* stringbuffer)
1385              Destroy a stringbuffer.
1386

STRINGBUFFER METHODS

1388       int      raptor_stringbuffer_append_counted_string(raptor_stringbuffer*
1389       stringbuffer, const unsigned char *string, size_t length, int do_copy)
1390              Append a string of length bytes to a  stringbuffer,  copying  it
1391              only if do_copy is non-0.
1392
1393       int    raptor_stringbuffer_append_string(raptor_stringbuffer*   string‐
1394       buffer, const unsigned char* string, int do_copy)
1395              Append a string to a stringbuffer, copying it only if do_copy is
1396              non-0.
1397
1398       int   raptor_stringbuffer_append_decimal(raptor_stringbuffer*   string‐
1399       buffer, int integer)
1400              Append a formatted decimal integer to a stringbuffer.
1401
1402       int        raptor_stringbuffer_append_stringbuffer(raptor_stringbuffer*
1403       stringbuffer, raptor_stringbuffer* append)
1404              Append  a  stringbuffer  append  to  a stringbuffer.  The append
1405              stringbuffer is emptied but not destroyed.
1406
1407       int     raptor_stringbuffer_prepend_counted_string(raptor_stringbuffer*
1408       stringbuffer, const unsigned char* string, size_t length, int do_copy)
1409              Prepend a string of length bytes to the start of a stringbuffer,
1410              copying it only if do_copy is non-0.
1411
1412       int   raptor_stringbuffer_prepend_string(raptor_stringbuffer*   string‐
1413       buffer, const unsigned char* string, int do_copy)
1414              Prepend a string to the start of a stringbuffer, copying it only
1415              if do_copy is non-0.
1416
1417       unsigned  char   *   raptor_stringbuffer_as_string(raptor_stringbuffer*
1418       stringbuffer)
1419              Return  the  stringbuffer  as  a  single  string.  The string is
1420              shared and should be copied if needed.
1421
1422       size_t raptor_stringbuffer_length(raptor_stringbuffer* stringbuffer)
1423              Return the length of the stringbuffer.
1424
1425       int   raptor_stringbuffer_copy_to_string(raptor_stringbuffer*   string‐
1426       buffer, unsigned char *string, size_t length)
1427              Copy the stringbuffer into a single string buffer string of size
1428              length.  Returns non-0 on failure.
1429

IOSTREAM CLASS

1431       This class provides an I/O stream that can write to  filenames,  FILE*,
1432       strings and user-defined output via callbacks.
1433

IOSTREAM CONSTRUCTOR

1435       raptor_iostream* raptor_new_iostream_from_handler2(void* context, const
1436       raptor_iostream_handler2 *handler)
1437              Create a new raptor read or write iostream from  a  user-defined
1438              raptor_iostream_handler2 handler that is called with the passed-
1439              in context for the write operations.
1440
1441       raptor_iostream* raptor_new_iostream_from_handler(void* context,  const
1442       raptor_iostream_handler *handler)
1443              DEPRECATED  in  1.4.17 - use raptor_new_iostream_from_handler2()
1444              with the new handler format.  Create a new raptor read  iostream
1445              from  a  user-defined  raptor_iostream_handler  handler  that is
1446              called with the passed-in context for the write operations.
1447
1448       raptor_iostream* raptor_new_iostream_to_sink(void)
1449              Create a new raptor write iostream  that  discards  all  written
1450              output.
1451
1452       raptor_iostream* raptor_new_iostream_to_filename(const char *filename)
1453              Create  a new raptor write iostream that creates and writes to a
1454              new file filename.
1455
1456       raptor_iostream* raptor_new_iostream_to_file_handle(FILE *handle)
1457              Create a new raptor write iostream that creates and writes to an
1458              existing, already opened, C Standard I/O handle FILE* handle.
1459
1460       raptor_iostream*  raptor_new_iostream_to_string(void **string_p, size_t
1461       *length_p, void *(*malloc_handler)(size_t size))
1462              Create a new raptor write iostream which creates  a  new  string
1463              once  raptor_free_iostream is called.  The new string pointer is
1464              written in string, the length in length_p (if not NULL) and  the
1465              memory  allocation is made using the malloc_handler, or if NULL,
1466              raptor's default memory allocator.
1467
1468       raptor_iostream* raptor_new_iostream_from_sink(void)
1469              Create a new raptor read iostream that is  immediately  finished
1470              and returns end of file.
1471
1472       raptor_iostream*  raptor_new_iostream_from_filename(const  char  *file‐
1473       name)
1474              Create a new raptor read iostream from an  existing  file  file‐
1475              name.
1476
1477       raptor_iostream* raptor_new_iostream_from_file_handle(FILE *handle)
1478              Create  a  new  raptor  read  iostream from an already opened, C
1479              Standard I/O handle FILE* handler.
1480
1481       raptor_iostream* raptor_new_iostream_from_string(void  *string,  size_t
1482       length)
1483              Create  a  new  raptor  read  iostream  reading from an existing
1484              string of length bytes.
1485

IOSTREAM DESTRUCTOR

1487       void raptor_free_iostream(raptor_iostream *iostr)
1488              Destroy a Raptor iostream object.
1489

IOSTREAM METHODS

1491       int  raptor_iostream_write_bytes(raptor_iostream  *iostr,  const   void
1492       *ptr, size_t size, size_t nmemb)
1493              Write  a  counted  set of elements to an iostream. Inmemb is the
1494              count of elements of size size, starting at memory ptr.  Similar
1495              to fwrite(3) and write(2).
1496
1497       int raptor_iostream_write_byte(raptor_iostream *iostr, const int byte)
1498              Write a single byte an iostream.  Similar to fputc(3).
1499
1500       void raptor_iostream_write_end(raptor_iostream *iostr)
1501              Finish writing to an iostream.
1502
1503       int  raptor_iostream_write_string(raptor_iostream  *iostr,  const  void
1504       *string)
1505              Write a  NUL-terminated  string  to  an  iostream.   Similar  to
1506              fputs(3).
1507
1508       int  raptor_iostream_write_counted_string(raptor_iostream *iostr, const
1509       void *string, size_t len)
1510              Write a string of length len to an iostream.
1511
1512       unsigned long raptor_iostream_tell(raptor_iostream *iostr)
1513              Return the byte offset into the iostream.
1514
1515       size_t raptor_iostream_get_bytes_written_count(raptor_iostream *iostr)
1516              DEPRECATED in 1.4.17  for  raptor_iostream_tell().   Return  the
1517              number of bytes written so far to the iostream.
1518
1519       int raptor_iostream_write_decimal(raptor_iostream *iostr, int integer)
1520              Write a decimal formatted integer integer to the iostream.
1521
1522       int raptor_iostream_format_hexadecimal(raptor_iostream *iostr, unsigned
1523       int integer, int width)
1524              Write a hexadecimal formatted unsigned integer to the  iostream,
1525              left-padded with '0's to width columns.
1526
1527       int   raptor_iostream_write_stringbuffer(raptor_iostream*  iostr,  rap‐
1528       tor_stringbuffer *sb)
1529              Write the stringbuffer to an iostream iostr.
1530
1531       int  raptor_iostream_read_bytes(raptor_iostream*  iostr,   void   *ptr,
1532       size_t size, size_t nmemb)
1533              Read  bytes  from  the iostream into buffer ptr up to nmemb ele‐
1534              ments of size size.
1535
1536       int raptor_iostream_read_eof(raptor_iostream *iostr)
1537              Return non-0 if the iostream is finished.
1538

XML SAX2 READER CLASS

1540       This class provides the functionality  to  generate  SAX2  events  from
1541       parsing XML content, including XML namespace support.
1542

XML SAX2 CONSTRUCTOR

1544       raptor_sax2*  raptor_new_sax2(void  *user_data,  raptor_error_handlers*
1545       error_handlers)
1546              Create a new SAX2  XML  reader  with  the  given  error  handler
1547              object.
1548

XML WRITER DESTRUCTOR

1550       void raptor_free_sax2(raptor_sax2 *sax2)
1551              Destroy a SAX2 XML reader object.
1552

SAX2 SET HANDLER METHODS

1554       void   raptor_sax2_set_start_element_handler(raptor_sax2   *sax2,  rap‐
1555       tor_sax2_start_element_handler handler)
1556              Set the SAX2 start element handler.
1557
1558       void   raptor_sax2_set_end_element_handler(raptor_sax2   *sax2,    rap‐
1559       tor_sax2_end_element_handler handler)
1560              Set the SAX2 end element handler.
1561
1562       void    raptor_sax2_set_characters_handler(raptor_sax2    *sax2,   rap‐
1563       tor_sax2_characters_handler handler)
1564              Set the SAX2 character data element handler.
1565
1566       void     raptor_sax2_set_cdata_handler(raptor_sax2     *sax2,      rap‐
1567       tor_sax2_cdata_handler handler)
1568              Set the SAX2 CDATA section element handler.
1569
1570       void     raptor_sax2_set_comment_handler(raptor_sax2     *sax2,    rap‐
1571       tor_sax2_comment_handler handler)
1572              Set the SAX2 XML comment handler.
1573
1574       void  raptor_sax2_set_unparsed_entity_decl_handler(raptor_sax2   *sax2,
1575       raptor_sax2_unparsed_entity_decl_handler handler)
1576              Set the SAX2 XML unparsed entity declaration handler.
1577
1578       void   raptor_sax2_set_external_entity_ref_handler(raptor_sax2   *sax2,
1579       raptor_sax2_external_entity_ref_handler handler)
1580              Set the SAX2 XML external entity reference handler.
1581
1582       void raptor_sax2_set_namespace_handler(raptor_sax2 *sax2, raptor_names‐
1583       pace_handler handler)
1584              Set  the  SAX2  XML  namespace  declaration  handler when an XML
1585              namespace is declared.
1586

SAX2 PARSING METHODS

1588       void raptor_sax2_parse_start(raptor_sax2 *sax2, raptor_uri *base_uri)
1589              Start a SAX2 parse of XML content with the base URI uri.
1590
1591       int  raptor_sax2_parse_chunk(raptor_sax2  *sax2,  const  unsigned  char
1592       *buffer, size_t len, int is_end)
1593              Parse  the  XML  content  in  buffer  of size len returning SAX2
1594              events via handlers.  If is_end is non-zero,  it  indicates  the
1595              end  of  the parsing.  This method can only be called after rap‐
1596              tor_sax2_parse_start().
1597

SAX2 SCOPE METHODS

1599       const   unsigned   char*   raptor_sax2_inscope_xml_language(raptor_sax2
1600       *sax2)
1601              Get the current in-scope XML language (xml:lang) value.
1602
1603       raptor_uri* raptor_sax2_inscope_base_uri(raptor_sax2 *sax2)
1604              Get  the current in-scope Base URI (xml:base or document or pro‐
1605              tocol) value.
1606

XML ELEMENT CLASS

1608       This class provides an XML element that can be used with the XML Writer
1609       Class to generate XML documents.
1610

XML ELEMENT CONSTRUCTORS

1612       raptor_xml_element*  raptor_new_xml_element(raptor_qname*  name,  const
1613       unsigned char* xml_language, raptor_uri* xml_base)
1614              Create a new XML element with the element name name in the  con‐
1615              text of xml:lang xml_language and base URI xml_base.
1616
1617       raptor_xml_element*                  raptor_new_xml_element_from_names‐
1618       pace_local_name(raptor_namespace *ns, const unsigned char *name,  const
1619       unsigned char* xml_language, raptor_uri* xml_base
1620              Create  a  new  XML element based on the given XML namespace and
1621              localname in the context of xml:lang xml_language and  base  URI
1622              xml_base.
1623

XML ELEMENT DESTRUCTOR

1625       void raptor_free_xml_element(raptor_xml_element *element)
1626              Destroy a XML element object.
1627

XML ELEMENT METHODS

1629       raptor_qname*  raptor_xml_element_get_name(raptor_xml_element* xml_ele‐
1630       ment)
1631              Get the XML element QName of XML element xml_element.
1632
1633       void raptor_xml_element_set_attributes(raptor_xml_element* xml_element,
1634       raptor_qname **attributes, int count)
1635              Set  the  attributes  on XML element xml_element to the array of
1636              QNames in array attributes of size count.
1637
1638       raptor_qname**    raptor_xml_element_get_attributes(raptor_xml_element*
1639       xml_element)
1640              Get  the attributes of an XML element xml_element as an array of
1641              QNames.  As set by void raptor_xml_element_set_attributes.
1642
1643       int         raptor_xml_element_get_attributes_count(raptor_xml_element*
1644       xml_element)
1645              Get  the  number  of attributes of an XML element xml_element as
1646              set by void raptor_xml_element_set_attributes.
1647
1648       int  raptor_xml_element_declare_namespace(raptor_xml_element*  xml_ele‐
1649       ment, raptor_namespace* nspace)
1650              Declare  an  XML  namespace  nspace  expliclitly  on XML element
1651              xml_element.  Namespaces used in the element or attribute  names
1652              are  automatically  declared, this method allows additional ones
1653              to be done.
1654
1655       int raptor_xml_element_is_empty(raptor_xml_element* xml_element)
1656              Return non-0 if the XML element is empty.
1657
1658       int  raptor_iostream_write_xml_element(raptor_iostream*   iostr,   rap‐
1659       tor_xml_element *element, raptor_namespace_stack* nstack, int is_empty,
1660       int   is_end,   raptor_simple_message_handler   error_handler,    void*
1661       error_data, int depth)
1662              Write  a XML element xml_element to iostream ostr.  This is done
1663              in context of an XML namespace stack nstack and at  depth  depth
1664              in the stack (see Namespace class constructors).
1665
1666              The  element  may be an empty element if is_empty is non-zero or
1667              may be a close element if is_end is non-zero (else  is  a  start
1668              element).   The error_handler method along with error_data allow
1669              error reporting to be given.
1670
1671       const  unsigned  char*  raptor_xml_element_get_language(raptor_xml_ele‐
1672       ment* xml_element)
1673              Get the xml:lang language of the XML element.
1674

XML WRITER CLASS

1676       This  class provides the functionality to generate simple XML documents
1677       consisting of elements with attributes, character  data  and  comments.
1678       The documents can be written to an iostream.
1679

XML WRITER CONSTRUCTOR

1681       raptor_xml_writer*        raptor_new_xml_writer(raptor_namespace_stack*
1682       nstack,  raptor_uri_handler*  uri_handler,  void*   uri_context,   rap‐
1683       tor_iostream*  iostr, raptor_simple_message_handler error_handler, void
1684       *error_data, int canonicalize)
1685              Create  a  new  XML  Writer  writing  to  iostream  iostr.   The
1686              error_handler method along with error_data allow error reporting
1687              to be given.  nstack is either an existing namespace stack to be
1688              used  or  if NULL, a new one with only the XML namespace defined
1689              is created.  Note that raptor_uri_get_handler can be  useful  to
1690              return  the current raptor URI handler/context.  canonicalize is
1691              currently unused and should be set to 1 but may allow non-canon‐
1692              ical XML writing to be allowed in future.
1693

XML WRITER DESTRUCTOR

1695       void raptor_free_xml_writer(raptor_xml_writer* xml_writer)
1696              Destroy a XML Writer object.
1697

XML WRITER METHODS

1699       void   raptor_xml_writer_empty_element(raptor_xml_writer*   xml_writer,
1700       raptor_xml_element *element)
1701              Write XML element element as an empty element (no  element  con‐
1702              tent) to the XML Writer xml_writer.
1703
1704       void   raptor_xml_writer_start_element(raptor_xml_writer*   xml_writer,
1705       raptor_xml_element *element)
1706              Write a start element along with  an  attributes  and  namespace
1707              declarations   for   XML  element  element  to  the  XML  Writer
1708              xml_writer.
1709
1710       void raptor_xml_writer_end_element(raptor_xml_writer* xml_writer,  rap‐
1711       tor_xml_element *element)
1712              Write  an  end  element  form for XML element element to the XML
1713              Writer xml_writer.
1714
1715       void   raptor_xml_writer_cdata(raptor_xml_writer*   xml_writer,   const
1716       unsigned char *str)
1717              Write  XML  character  data in str to the XML Writer xml_writer.
1718              The characters in str will be XML escaped.
1719
1720       void   raptor_xml_writer_cdata_counted(raptor_xml_writer*   xml_writer,
1721       const unsigned char* str, unsigned int length)
1722              Write  XML  character  data  in  str of length length to the XML
1723              Writer xml_writer.  The characters in str will be XML escaped.
1724
1725       void   raptor_xml_writer_raw(raptor_xml_writer*    xml_writer,    const
1726       unsigned char* str)
1727              Write  character data in str length to the XML Writer xml_writer
1728              without XML escaping.
1729
1730       void raptor_xml_writer_raw_counted(raptor_xml_writer* xml_writer, const
1731       unsigned char* str, unsigned int length)
1732              Write  character  data in str of length length to the XML Writer
1733              xml_writer without XML escaping.
1734
1735       void  raptor_xml_writer_comment(raptor_xml_writer*  xml_writer,   const
1736       unsigned char* str)
1737              Write an XML comment in str to the XML Writer xml_writer.
1738
1739       void  raptor_xml_writer_comment_counted(raptor_xml_writer*  xml_writer,
1740       const unsigned char* str, unsigned int length)
1741              Write an XML comment in str of length length to the  XML  Writer
1742              xml_writer.
1743
1744       int  raptor_xml_writer_features_enumerate(const raptor_feature feature,
1745       const char **name, raptor_uri **uri, const char **label)
1746              Return the name, URI, string label (all  optional)  for  an  XML
1747              write feature, returning non-zero if no such feature exists.
1748
1749       Raptor features have URIs that are constructed from the URI http://fea
1750       ture.librdf.org/raptor- and the name so for example feature  scanForRDF
1751       has URI http://feature.librdf.org/raptor-scanForRDF
1752
1753       int  raptor_xml_writer_set_feature(raptor_xml_writer*  xml_writer, rap‐
1754       tor_feature feature, int value)
1755              Set an  XML  writer  feature  feature  to  a  particular  value.
1756              Returns non 0 on failure or if the feature is unknown.  The cur‐
1757              rent defined writer features are:
1758                Feature                                 Values
1759                RAPTOR_FEATURE_WRITER_AUTO_INDENT       Boolean (non 0 true)
1760                RAPTOR_FEATURE_WRITER_AUTO_EMPTY        Boolean (non 0 true)
1761                RAPTOR_FEATURE_WRITER_INDENT_WIDTH      Integer
1762                RAPTOR_FEATURE_WRITER_XML_DECLARATION   Boolean (non 0 true)
1763
1764       If the writer_auto_indent feature is set (default true), the XML writer
1765       will automatically indent the output.
1766
1767       If  the writer_auto_empty feature is set (default true), the XML writer
1768       will automatically generate  empty  elements  if  a  start/end  element
1769       sequence has no content.
1770
1771       If the writer_indent_width feature is set (default 2) if the XML writer
1772       is outputing indented XML, it will use that many spaces.
1773
1774       If the writer_xml_declaration feature is set  (default  true)  the  XML
1775       declaration is written at the start of serialized XML.
1776
1777       int raptor_xml_writer_set_feature_string(raptor_xml_writer *xml_writer,
1778       raptor_feature feature, const unsigned char *value)
1779              Set an XML writer feature feature to a particular string  value.
1780              Returns non 0 on failure or if the feature is unknown.  The cur‐
1781              rent  defined  XML   writer   features   are   given   in   rap‐
1782              tor_xml_writer_set_feature and at present only take integer val‐
1783              ues. If an integer value feature  is  set  with  this  function,
1784              value is interpreted as an integer and then that value is used.
1785
1786       int  raptor_xml_writer_get_feature(raptor_xml_writer*  xml_writer, rap‐
1787       tor_feature feature)
1788              Get XML writer feature integer values.  The allowed feature val‐
1789              ues and types are given under raptor_xml_writer_features_enumer‐
1790              ate.
1791
1792       const    unsigned    char    *raptor_xml_writer_get_feature_string(rap‐
1793       tor_xml_writer* xml_writer, raptor_feature feature)
1794              Get XML writer feature string values. The allowed feature values
1795              and types are given under raptor_xml_writer_features_enumerate.
1796
1797       int raptor_xml_writer_get_depth(raptor_xml_writer* xml_writer)
1798              Get the current XML writer element stack depth.
1799
1800       void raptor_xml_writer_flush(raptor_xml_writer* xml_writer)
1801              Flush the XML writer output for any pending writes.
1802
1803       void raptor_xml_writer_newline(raptor_xml_writer* xml_writer)
1804              Write a newline to the XML writer (which may  trigger  indenting
1805              before the next item).
1806

WORLD CLASS

1808       This  class stores the library state and configuration.  It will be the
1809       main class for initialsiing and configuring the library in Raptor 2.0.
1810

WORLD CLASS CONSTRUCTOR

1812       raptor_world* raptor_new_world(void)
1813              Create a new raptor library object.
1814

WORLD CLASS DESTRUCTOR

1816       void raptor_free_world(raptor_world* world)
1817              Destroy a raptor library object and free all resources.
1818

WORLD CLASS METHODS

1820       int raptor_world_open(raptor_world* world)
1821              Start using a raptor library - allocate any dependent resources.
1822              This is optional.
1823
1824       void raptor_world_set_libxslt_security_preferences(raptor_world *world,
1825       void *security_preferences)
1826              See raptor_set_libxslt_security_preferences() description.
1827
1828       void raptor_world_set_libxml_flags(raptor_world *world,  int flags)
1829              See raptor_set_libxml_flags() description.
1830

API CHANGES

1832   1.4.21
1833       No changes.
1834
1835   1.4.20
1836       No changes.
1837
1838   1.4.19
1839       Added raptor_world class to prepare for V2 API  with  constructor  rap‐
1840       tor_new_world(),   destructor   raptor_free_world()  and  methods  rap‐
1841       tor_world_open(),  raptor_world_set_libxslt_security_preferences()  and
1842       raptor_world_set_libxml_flags().
1843
1844       The raptor_identifier, raptor_error_handlers structs both gained a rap‐
1845       tor_world* pointer field.
1846
1847       Added      raptor_set_libxslt_security_preferences()      and      rap‐
1848       tor_set_libxml_flags().
1849
1850       Added     raptor_libxml_flags     enum     for     flags    for    rap‐
1851       tor_world_set_libxml_flags() and raptor_set_libxml_flags().
1852
1853       Added RAPTOR_FEATURE_PREFIX_ELEMENTS
1854
1855   1.4.18
1856       Added atom serializer
1857
1858       Added rdfa parser
1859
1860       Added serializer features  RAPTOR_FEATURE_RSS_TRIPLES  and  RAPTOR_FEA‐
1861       TURE_ATOM_ENTRY_URI
1862
1863       Added raptor_qname_to_counted_name()
1864
1865       Added raptor_serialize_start_to_iostream()
1866
1867       Added raptor_sequence_delete_at()
1868
1869       Added raptor_xml_writer_newline()
1870
1871       Added raptor_xml_writer_flush()
1872
1873       Added raptor_xml_writer_get_depth()
1874
1875   1.4.17
1876       Added  SAX2  class  raptor_sax2.   Added  new  SAX2  API typedefs: rap‐
1877       tor_sax2_start_element_handler,  raptor_sax2_end_element_handler,  rap‐
1878       tor_sax2_characters_handler,       raptor_sax2_cdata_handler,      rap‐
1879       tor_sax2_comment_handler, raptor_sax2_unparsed_entity_decl_handler  and
1880       raptor_sax2_external_entity_ref_handler.  Added new SAX2 API functions:
1881       raptor_new_sax2(),    raptor_free_sax2(),    raptor_sax2_set_start_ele‐
1882       ment_handler(),       raptor_sax2_set_end_element_handler(),       rap‐
1883       tor_sax2_set_characters_handler(),     raptor_sax2_set_cdata_handler(),
1884       raptor_sax2_set_comment_handler(),                                 rap‐
1885       tor_sax2_set_unparsed_entity_decl_handler(),     raptor_sax2_set_exter‐
1886       nal_entity_ref_handler(),   raptor_sax2_set_namespace_handler(),   rap‐
1887       tor_sax2_parse_start(),         raptor_sax2_parse_chunk(),         rap‐
1888       tor_sax2_inscope_xml_language() and raptor_sax2_inscope_base_uri()
1889
1890       Added      features      RAPTOR_FEATURE_WRITE_BASE_URI,     RAPTOR_FEA‐
1891       TURE_WWW_HTTP_CACHE_CONTROL,  RAPTOR_FEATURE_WWW_HTTP_USER_AGENT,  RAP‐
1892       TOR_FEATURE_JSON_CALLBACK and RAPTOR_FEATURE_JSON_EXTRA_DATA
1893
1894       Added raptor_handler_closure structure for error handlers.
1895
1896       Added raptor_statement_compare()
1897
1898       Added   raptor_iostream_write_string_python()   and   deprecated   rap‐
1899       tor_iostream_write_string_turtle()
1900
1901       raptor_uri_set_handler(),  raptor_uri_get_handler(),  raptor_new_names‐
1902       paces(),  raptor_namespaces_init() and raptor_new_xml_writer() now take
1903       const handler pointers.
1904
1905       Added raptor_www_set_http_cache_control()
1906
1907       Added  QName   class   methods:   raptor_qname_get_local_name(),   rap‐
1908       tor_qname_get_value() and raptor_qname_get_counted_value()
1909
1910       Added      raptor_iostream      read      handler     typedefs     rap‐
1911       tor_iostream_read_bytes_func, raptor_iostream_read_eof_func  and  added
1912       new   structure   raptor_iostream_handler2  replacing  deprecated  rap‐
1913       tor_iostream_handler.
1914
1915       Added  raptor_new_iostream_from_handler2()  replacing  deprecated  rap‐
1916       tor_new_iostream_from_handler()
1917
1918       Added  raptor_new_iostream_from_sink(),  raptor_new_iostream_from_file‐
1919       name(),      raptor_new_iostream_from_file_handle()      and       rap‐
1920       tor_new_iostream_from_string().
1921
1922       Added  raptor_iostream_tell deprecating raptor_iostream_get_bytes_writ‐
1923       ten_count().
1924
1925       Added raptor_iostream_read_bytes() and raptor_iostream_read_eof().
1926
1927       Added raptor_xml_element_get_language().
1928
1929       Added new enum raptor_log_level.
1930
1931       Added  new  typedef  raptor_error_handlers.   and  new  function   rap‐
1932       tor_error_handlers_init().
1933
1934   1.4.16
1935       raptor_namespaces_init() now returns an integer status
1936
1937       Added raptor_new_xml_element_from_namespace_local_name()
1938
1939       Added raptor_uri_compare().
1940
1941       Added    new    features    for   the   'grddl'   parser:   RAPTOR_FEA‐
1942       TURE_HTML_TAG_SOUP,   RAPTOR_FEATURE_MICROFORMATS    and    RAPTOR_FEA‐
1943       TURE_HTML_LINK.
1944
1945       Added parser feature RAPTOR_FEATURE_WWW_TIMEOUT
1946
1947       Added raptor_graph_handler typedef and raptor_set_graph_handler()
1948
1949       Added      raptor_www_final_uri_handler      typedef      and      rap‐
1950       tor_www_set_final_uri_handler()
1951
1952       Added raptor_www_set_connection_timeout()
1953
1954       Added raptor_www_get_final_uri()
1955
1956   1.4.15
1957       No changes.
1958
1959   1.4.14
1960       Add  two  new   exported   strings   raptor_license_string   and   rap‐
1961       tor_home_url_string.
1962
1963       Added    new   features   for   the   'dot'   serializer:   RAPTOR_FEA‐
1964       TURE_RESOURCE_BORDER,    RAPTOR_FEATURE_LITERAL_BORDER,     RAPTOR_FEA‐
1965       TURE_BNODE_BORDER,   RAPTOR_FEATURE_RESOURCE_FILL,  RAPTOR_FEATURE_LIT‐
1966       ERAL_FILL and RAPTOR_FEATURE_BNODE_FILL
1967
1968       Added raptor_parser_generate_id()
1969
1970       Added raptor_iostream_write_string_turtle()
1971
1972   1.4.13
1973       No API changes.
1974
1975   1.4.12
1976       No API changes.
1977
1978   1.4.11
1979       Added raptor_get_feature_count()
1980
1981       Added raptor_get_need_base_uri()
1982
1983       Added parser feature RAPTOR_FEATURE_NO_NET
1984
1985       Added raptor_www_set_uri_filter(), raptor_parser_set_uri_filter()  with
1986       filter type raptor_uri_filter_func
1987
1988   1.4.10
1989       No API changes.
1990
1991   1.4.9
1992       Added raptor_parser_get_accept_header()
1993
1994       Added raptor_xml_element_is_empty()
1995
1996       Added raptor_qname_get_namespace()
1997
1998       Added raptor_iostream_write_uri()
1999
2000       Added raptor_namespaces_qname_from_uri().
2001
2002       Added raptor_namespace_get_counted_prefix()
2003
2004       Added raptor_serialize_set_namespace_from_namespace()
2005
2006       Deprecated       raptor_uri_is_file_uri()       for       new      rap‐
2007       tor_uri_string_is_file_uri().
2008
2009       Added    raptor_xml_element_get_attributes()    and     raptor_xml_ele‐
2010       ment_get_attributes_count()
2011
2012   1.4.8
2013       Added raptor_set_namespace_handler().
2014
2015       Added    XML    1.1    serializing    support,    feature   RAPTOR_FEA‐
2016       TURE_WRITER_XML_VERSION with shortname xmlVersion  for  serializer  and
2017       xml writer classes to support it.  Added XML writer feature RAPTOR_FEA‐
2018       TURE_WRITER_XML_DECLARATION to control generation of the  XML  declara‐
2019       tion.   Added  new  functions  raptor_xml_any_escape_string()  and rap‐
2020       tor_iostream_write_xml_any_escaped_string() to allow generating XML 1.1
2021       or XML 1.0.
2022
2023       RAPTOR_IDENTIFIER_TYPE_PREDICATE  will no longer be generated from ver‐
2024       sion 1.4.9 onwards as the type of returned statement predicates.   RAP‐
2025       TOR_IDENTIFIER_TYPE_RESOURCE will be returned.
2026
2027       RAPTOR_IDENTIFIER_TYPE_ORDINAL  may no longer be generated from version
2028       1.4.9 onwards, RAPTOR_IDENTIFIER_TYPE_RESOURCE may replace it.
2029
2030   1.4.7
2031       No changes.
2032
2033   1.4.6
2034       No changes.
2035
2036   1.4.5
2037       Deprecated  raptor_ntriples_string_as_utf8_string()  (never  documented
2038       above)  since  it can only work with a raptor_parser object which makes
2039       it rather unusable alone.
2040
2041       Added XML writer features and support functions  raptor_xml_writer_fea‐
2042       tures_enumerate(),         raptor_xml_writer_set_feature(),        rap‐
2043       tor_xml_writer_set_feature_string(),    raptor_xml_writer_get_feature()
2044       and raptor_xml_writer_get_feature_string()
2045
2046   1.4.3
2047       Added  XML Writer class (raptor_xml_writer) and XML Element class (rap‐
2048       tor_xml_element)
2049
2050       Added    raptor_parser_get_feature_string(),     raptor_parser_set_fea‐
2051       ture_string(),  raptor_serializer_set_feature_string(),  raptor_serial‐
2052       izer_get_feature_string() and raptor_feature_value_type().
2053
2054       Added raptor_serializer_set_namespace,  raptor_serializer_set_feature()
2055       and raptor_serializer_get_feature().
2056
2057       Added         raptor_new_namespace_from_uri(),        raptor_new_names‐
2058       pace_parts_from_string(),      Added      raptor_namespaces_find_names‐
2059       pace_by_uri().  and raptor_iostream_write_namespace() to write a names‐
2060       pace declaration to an iostream.
2061
2062       Added     copy     constructor     raptor_qname_copy()     and     rap‐
2063       tor_iostream_write_qname() to write a qname to an iostream.
2064
2065       Added raptor_sequence_join() to join two sequences, leaving one empty.
2066
2067       Added  raptor_iostream_write_stringbuffer()  to write a stringbuffer to
2068       an iostream.
2069
2070       Added  N-Triples   raptor_iostream_write_string_ntriples()   and   rap‐
2071       tor_iostream_write_statement_ntriples()  utility  functions for writing
2072       to raptor_iostreams.
2073
2074       Added raptor_uri_to_relative_counted_uri_string(),  raptor_uri_to_rela‐
2075       tive_uri_string().   raptor_uri_print(), raptor_uri_to_counted_string()
2076       and raptor_uri_to_string()
2077
2078       Added unicode name checking utility functions for XML 1.0 and  XML  1.1
2079       name  starting  character  and  continued  name character.  raptor_uni‐
2080       code_is_xml10_namestartchar   raptor_unicode_is_xml10_namechar,    rap‐
2081       tor_unicode_is_xml11_namechar     and    raptor_unicode_is_xml11_names‐
2082       tartchar.
2083
2084       Added raptor_xml_name_check to check if a name is a legal  XML  1.0  or
2085       1.0  name.   and  raptor_iostream_write_xml_escaped_string  to write an
2086       XML-escaped string to an iostream.
2087
2088       Added UTF8-checking utility function raptor_utf8_check.
2089
2090   1.4.2
2091       No changes.
2092
2093   1.4.1
2094       The raptor_xml_escape_string now returns <0 on failure rather  than  0,
2095       so that if an empty string is escaped, 0 bytes required is returned.
2096
2097   1.4.0
2098       Added  new raptor_serializer class supporting RDF/XML (name rdfxml) and
2099       N-Triples (name ntriples).
2100       Added new raptor_iostream class
2101       Added raptor_stringbuffer_copy_to_string to allow efficient copy-out of
2102       a constructed string.
2103       Added  raptor_www_fetch_to_string to allow retrieving of web content as
2104       a single string.
2105
2106   1.3.3
2107       Added raptor_calloc_memory to provide a calloc inside raptor.
2108       Added feature check_rdf_id (see raptor_set_feature documentation).
2109
2110   1.3.2
2111       Added raptor_alloc_memory to allocate memory inside raptor.
2112
2113       Added accessor functions for the public raptor_locator structure:
2114
2115       raptor_locator_line
2116       raptor_locator_column
2117       raptor_locator_byte
2118       raptor_locator_file
2119       raptor_locator_uri
2120
2121   1.3.1
2122       Correct raptor_print_statement declaration argument statement  to  have
2123       one less 'const', to match the code.
2124
2125   1.3.0
2126       Added  the  following  parser methods, utility methods and helper func‐
2127       tions:
2128
2129       raptor_new_parser_for_content (Parser class constructor)
2130       raptor_get_mime_type
2131       raptor_get_feature
2132       raptor_syntax_name_check
2133       raptor_guess_parser_name
2134       raptor_features_enumerate
2135       raptor_feature_from_uri
2136       raptor_www_set_http_accept (WWW class)
2137
2138       Changed raptor_set_feature to now return an int success or failure.
2139
2140       Added the following functions:
2141       raptor_free_memory
2142       raptor_unicode_char_to_utf8
2143       raptor_utf8_to_unicode_char
2144       raptor_vsnprintf
2145
2146       Added the raptor_sequence class, its constructor,  destructor,  methods
2147       and helper functions.
2148
2149       Added  the  raptor_stringbuffer  class  and constructor, destructor and
2150       methods.
2151
2152       Deprecated raptor_print_statement_detailed always intended to be inter‐
2153       nal.
2154
2155   1.2.0
2156       Added  raptor_syntaxes_enumerate to get full information on syntax mime
2157       type and URIs as well as name and label.
2158
2159       N-Triples Plus parser renamed to Turtle (name turtle)
2160
2161   1.1.0
2162       Added N-Triples Plus parser (name ntriples-plus)
2163
2164       Made URI class constructors, methods and factory  methods  as  well  as
2165       some  other  utility functions using or returning URIs or literals take
2166       unsigned char* rather than char*.  The affected calls are:
2167
2168       URI factory methods changed to all take/return unsigned char*  for  URI
2169       strings:
2170       raptor_new_uri_func
2171       raptor_new_uri_from_local_name_func
2172       raptor_new_uri_relative_to_base_func
2173       raptor_uri_as_string_func
2174       raptor_uri_as_counted_string_func
2175
2176       Constructors  and methods changed to take/return unsigned char* for URI
2177       strings:
2178       raptor_statement_part_as_counted_string
2179       raptor_statement_part_as_string
2180       raptor_new_uri
2181       raptor_new_uri_from_uri_local_name
2182       raptor_new_uri_relative_to_base
2183       raptor_uri_as_string
2184       raptor_uri_as_counted_string
2185       raptor_print_ntriples_string
2186
2187       Changed to use unsigned char* for URI strings, char* for filenames:
2188       raptor_uri_resolve_uri_reference
2189       raptor_uri_filename_to_uri_string
2190       raptor_uri_uri_string_to_filename
2191       raptor_uri_uri_string_to_filename_fragment
2192       raptor_uri_is_file_uri
2193
2194       Changed to return unsigned char* for UTF8 string:
2195       raptor_ntriples_string_as_utf8_string
2196
2197       Added raptor_parsers_enumerate to discover supported parsers.
2198
2199       Added raptor_uri_uri_string_to_filename_fragment with fragment  arg  to
2200       return the URI fragment.
2201
2202       Made  the  raptor_namespace,  raptor_namespace_stack  and  raptor_qname
2203       class and APIs public.
2204
2205       Added feature non_nfc_fatal (see raptor_set_feature documentation).
2206
2207   1.0.0
2208       Removed the following  deprecated  methods  and  functions  (see  0.9.6
2209       changes for the new names):
2210       raptor_free,   raptor_new,  raptor_ntriples_free,  raptor_ntriples_new,
2211       raptor_ntriples_parse_file,   raptor_ntriples_set_error_handler,   rap‐
2212       tor_ntriples_set_fatal_error_handler,        raptor_ntriples_set_state‐
2213       ment_handler and raptor_parser_abort.
2214
2215       Added raptor_parse_file_stream for reading FILE* streams without neces‐
2216       sarily having a file.
2217
2218   0.9.12
2219       Added  raptor_new_uri_for_retrieval  to  turn  URI references into URIs
2220       suitable for retrieval (no fragments).
2221
2222   0.9.11
2223       Added raptor_get_name and raptor_get_label.
2224
2225       raptor_xml_escape_string now takes error message handler, data pointer,
2226       loses parser argument.
2227
2228       Added  raptor_set_default_generate_id_parameters  and raptor_set_gener‐
2229       ate_id_handler to control the default generation  of  IDs,  allow  full
2230       customisation.
2231
2232   0.9.10
2233       Added  raptor_set_parser_strict and raptor_www_no_www_library_init_fin‐
2234       ish.
2235
2236       raptor_xml_escape_string now takes an output string length pointer.
2237
2238       Added      raptor_statement_part_as_counted_string,       raptor_state‐
2239       ment_part_as_string and raptor_parse_abort.
2240
2241       Deprecated raptor_parser_abort.
2242
2243   0.9.9
2244       Added  raptor_www  class and all its constructors, destructor, methods,
2245       calls.
2246
2247       Added        raptor_parse_uri,        raptor_parser_abort,         rap‐
2248       tor_ntriples_term_as_string and raptor_xml_escape_string.
2249
2250   0.9.7
2251       raptor_parse_chunk,  raptor_new_uri_from_id, arguments are now unsigned
2252       char.
2253
2254       Added raptor_new_uri_for_xmlbase.
2255
2256   0.9.6
2257       In this version, the raptor/ntriples parser calling APIs were modified.
2258       The following table lists the changes:
2259
2260       OLD API                                  NEW API (0.9.6+)
2261       raptor_new()                             raptor_new_parser("rdfxml")
2262       ntriples_new()                           raptor_new_parser("ntriples")
2263       raptor_free                              raptor_free_parser
2264       ntriples_free                            raptor_ntriples_parser
2265       raptor_ntriples_parse_file               raptor_parse_file
2266       raptor_ntriples_set_error_handler        raptor_set_error_handler
2267       raptor_ntriples_set_fatal_error_handler  raptor_set_fatal_error_handler
2268       raptor_ntriples_set_statement_handler    raptor_set_statement_handler
2269

CONFORMING TO

2271       RDF/XML  Syntax  (Revised),  Dave  Beckett  (ed.)   W3C Recommendation,
2272       http://www.w3.org/TR/rdf-syntax-grammar/http://www.w3.org/TR/rdf-
2273       syntax-grammar/⟩
2274
2275       N-Triples,  in  RDF  Test Cases, Jan Grant and Dave Beckett (eds.)  W3C
2276       Recommendation,            http://www.w3.org/TR/rdf-testcases/#ntriples
2277http://www.w3.org/TR/rdf-testcases/#ntriples⟩
2278
2279       Turtle     -    Terse    RDF    Triple    Language,    Dave    Beckett,
2280       http://www.dajobe.org/2004/01/turtle/
2281http://www.dajobe.org/2004/01/turtle/
2282
2283       RSS     0.91     spec     revision     3,    Dan    Libby,    Netscape,
2284       http://my.netscape.com/publish/formats/rss-spec-0.91.html
2285http://my.netscape.com/publish/formats/rss-spec-0.91.html
2286
2287       RDF    Site    Summary    (RSS)    1.0,    http://purl.org/rss/1.0/spec
2288http://purl.org/rss/1.0/spec
2289
2290       Atom       1.0       syndication        format,        RFC        4287,
2291       http://www.ietf.org/rfc/rfc4287.txt
2292http://www.ietf.org/rfc/rfc4287.txt
2293
2294       Gleaning Resource Descriptions from Dialects of Languages (GRDDL),  Dan
2295       Connolly       (ed.),       W3C       Recommendation,       2007-09-11,
2296       http://www.w3.org/TR/2007/REC-grddl-20070911/
2297http://www.w3.org/TR/2007/REC-grddl-20070911/
2298
2299       RDFa  in  XHTML:  Syntax and Processing, Ben Adida, Mark Birbeck, Shane
2300       McCarron, Steven Pemberton (eds.)
2301        W3C  Recommendation,  2008-10-14,  http://www.w3.org/TR/2008/REC-rdfa-
2302       syntax-20081014/ ⟨http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014/
2303
2304

SEE ALSO

2306       rapper(1),raptor-config(1)
2307

AUTHOR

2309       Dave Beckett - http://www.dajobe.org/http://www.dajobe.org/
2310
2311
2312
2313                                  2010-01-29                      libraptor(3)
Impressum