Features

Features — Parser and Serializer features

Synopsis




enum        raptor_feature;
unsigned int raptor_get_feature_count       (void);
int         raptor_features_enumerate       (const raptor_feature feature,
                                             const char **name,
                                             raptor_uri **uri,
                                             const char **label);
raptor_feature raptor_feature_from_uri      (raptor_uri *uri);
int         raptor_feature_value_type       (const raptor_feature feature);

Description

Optional parameters for raptor_parser and raptor_serializer objects that can be get and set. Utility functions also exist to enumerate them, their description and the parameter type taken.

Details

enum raptor_feature

typedef enum {
  RAPTOR_FEATURE_SCANNING,
  RAPTOR_FEATURE_ASSUME_IS_RDF,
  RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES,
  RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES,
  RAPTOR_FEATURE_ALLOW_BAGID,
  RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST,
  RAPTOR_FEATURE_NORMALIZE_LANGUAGE,
  RAPTOR_FEATURE_NON_NFC_FATAL,
  RAPTOR_FEATURE_WARN_OTHER_PARSETYPES,
  RAPTOR_FEATURE_CHECK_RDF_ID,
  RAPTOR_FEATURE_RELATIVE_URIS,
  RAPTOR_FEATURE_START_URI,
  RAPTOR_FEATURE_WRITER_AUTO_INDENT,
  RAPTOR_FEATURE_WRITER_AUTO_EMPTY,
  RAPTOR_FEATURE_WRITER_INDENT_WIDTH,
  RAPTOR_FEATURE_WRITER_XML_VERSION,
  RAPTOR_FEATURE_WRITER_XML_DECLARATION,
  RAPTOR_FEATURE_NO_NET,
  RAPTOR_FEATURE_LAST=RAPTOR_FEATURE_NO_NET
} raptor_feature;

Raptor parser, serializer or XML writer features.

RAPTOR_FEATURE_SCANNING If true (default false), the RDF/XML parser will look for embedded rdf:RDF elements inside the XML content, and not require that the XML start with an rdf:RDF root element.
RAPTOR_FEATURE_ASSUME_IS_RDF If true (default false) then the RDF/XML parser will assume the content is RDF/XML, not require that rdf:RDF root element, and immediately interpret the content as RDF/XML.
RAPTOR_FEATURE_ALLOW_NON_NS_ATTRIBUTES If true (default true) then the RDF/XML parser will allow non-XML namespaced attributes to be accepted as well as rdf: namespaced ones. For example, 'about' and 'ID' will be interpreted as if they were rdf:about and rdf:ID respectively.
RAPTOR_FEATURE_ALLOW_OTHER_PARSETYPES If true (default true) then the RDF/XML parser will allow unknown parsetypes to be present and will pass them on to the user. Unimplemented at present.
RAPTOR_FEATURE_ALLOW_BAGID If true (default true) then the RDF/XML parser will support the rdf:bagID attribute that was removed from the RDF/XML language when it was revised. This support may be removed in future.
RAPTOR_FEATURE_ALLOW_RDF_TYPE_RDF_LIST If true (default false) then the RDF/XML parser will generate the idList rdf:type rdf:List triple in the handling of rdf:parseType="Collection". This triple was removed during the revising of RDF/XML after collections were initially added.
RAPTOR_FEATURE_NORMALIZE_LANGUAGE If true (default true) then XML language values such as from xml:lang will be normalized to lowercase.
RAPTOR_FEATURE_NON_NFC_FATAL If true (default false) then illegal Unicode Normal Form C in literals will give a fatal error, otherwise just a warning.
RAPTOR_FEATURE_WARN_OTHER_PARSETYPES If true (default true) then the RDF/XML parser will warn about unknown rdf:parseType values.
RAPTOR_FEATURE_CHECK_RDF_ID If true (default true) then the RDF/XML will check rdf:ID attribute values for duplicates and cause an error if any are found.
RAPTOR_FEATURE_RELATIVE_URIS If true (default true) then relative URIs will be used wherever possible when serializing.
RAPTOR_FEATURE_START_URI Set the start URI for serlalizing to use.
RAPTOR_FEATURE_WRITER_AUTO_INDENT Automatically indent elements when seriailizing.
RAPTOR_FEATURE_WRITER_AUTO_EMPTY Automatically detect and abbreviate empty elements when serializing.
RAPTOR_FEATURE_WRITER_INDENT_WIDTH Integer number of spaces to use for each indent level when serializing with auto indent.
RAPTOR_FEATURE_WRITER_XML_VERSION Integer XML version XML 1.0 (10) or XML 1.1 (11)
RAPTOR_FEATURE_WRITER_XML_DECLARATION Write XML 1.0 or 1.1 declaration.
RAPTOR_FEATURE_NO_NET Deny network requests
RAPTOR_FEATURE_LAST Internal

raptor_get_feature_count ()

unsigned int raptor_get_feature_count       (void);

Get the count of features defined.

This is prefered to the compile time-only symbol RAPTOR_FEATURE_LAST and returns a count of the number of features which is RAPTOR_FEATURE_LAST+1.

Returns : count of features in the raptor_feature enumeration

raptor_features_enumerate ()

int         raptor_features_enumerate       (const raptor_feature feature,
                                             const char **name,
                                             raptor_uri **uri,
                                             const char **label);

Get list of syntax features.

If uri is not NULL, a pointer toa new raptor_uri is returned that must be freed by the caller with raptor_free_uri().

feature : feature enumeration (0+)
name : pointer to store feature short name (or NULL)
uri : pointer to store feature URI (or NULL)
label : pointer to feature label (or NULL)
Returns : 0 on success, <0 on failure, >0 if feature is unknown

raptor_feature_from_uri ()

raptor_feature raptor_feature_from_uri      (raptor_uri *uri);

Turn a feature URI into an feature enum.

The allowed feature URIs are available via raptor_features_enumerate().

uri : feature URI
Returns : < 0 if the feature is unknown

raptor_feature_value_type ()

int         raptor_feature_value_type       (const raptor_feature feature);

Get the type of a features.

The type of the feature is 0=integer , 1=string. Other values are undefined. Most features are integer values and use raptor_set_feature and raptor_get_feature() ( raptor_serializer_set_feature raptor_serializer_get_feature() )

String value features use raptor_parser_set_feature_string() and raptor_parser_get_feature_string() ( raptor_serializer_set_feature_string() and raptor_serializer_get_feature_string() )

feature : raptor serializer or parser feature
Returns : the type of the feature or <0 if feature is unknown