Options

## Options Options — Class options |

## Synopsis

    enum                raptor_option;
                        raptor_option_description;
    unsigned int        raptor_option_get_count             (void);
    enum                raptor_option_value_type;
    const char *        raptor_option_get_value_type_label  (const raptor_option_value_type type);
    raptor_option_description * raptor_world_get_option_description
                                                            (raptor_world *world,
                                                             const raptor_domain domain,
                                                             const raptor_option option);
    void                raptor_free_option_description      (raptor_option_description *option_description);
    raptor_option       raptor_world_get_option_from_uri    (raptor_world *world,
                                                             raptor_uri *uri);

## Description

Options for several classes such as raptor_parser, raptor_serializer raptor_sax2 and raptor_xml_writer that can be get and set. Utility functions exist to enumerate them, their description and the parameter type taken.

## Details

### enum raptor_option

    typedef enum {
      RAPTOR_OPTION_SCANNING,
      RAPTOR_OPTION_ALLOW_NON_NS_ATTRIBUTES,
      RAPTOR_OPTION_ALLOW_OTHER_PARSETYPES,
      RAPTOR_OPTION_ALLOW_BAGID,
      RAPTOR_OPTION_ALLOW_RDF_TYPE_RDF_LIST,
      RAPTOR_OPTION_NORMALIZE_LANGUAGE,
      RAPTOR_OPTION_NON_NFC_FATAL,
      RAPTOR_OPTION_WARN_OTHER_PARSETYPES,
      RAPTOR_OPTION_CHECK_RDF_ID,
      RAPTOR_OPTION_RELATIVE_URIS,
      RAPTOR_OPTION_WRITER_AUTO_INDENT,
      RAPTOR_OPTION_WRITER_AUTO_EMPTY,
      RAPTOR_OPTION_WRITER_INDENT_WIDTH,
      RAPTOR_OPTION_WRITER_XML_VERSION,
      RAPTOR_OPTION_WRITER_XML_DECLARATION,
      RAPTOR_OPTION_NO_NET,
      RAPTOR_OPTION_RESOURCE_BORDER,
      RAPTOR_OPTION_LITERAL_BORDER,
      RAPTOR_OPTION_BNODE_BORDER,
      RAPTOR_OPTION_RESOURCE_FILL,
      RAPTOR_OPTION_LITERAL_FILL,
      RAPTOR_OPTION_BNODE_FILL,
      RAPTOR_OPTION_HTML_TAG_SOUP,
      RAPTOR_OPTION_MICROFORMATS,
      RAPTOR_OPTION_HTML_LINK,
      RAPTOR_OPTION_WWW_TIMEOUT,
      RAPTOR_OPTION_WRITE_BASE_URI,
      RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL,
      RAPTOR_OPTION_WWW_HTTP_USER_AGENT,
      RAPTOR_OPTION_JSON_CALLBACK,
      RAPTOR_OPTION_JSON_EXTRA_DATA,
      RAPTOR_OPTION_RSS_TRIPLES,
      RAPTOR_OPTION_ATOM_ENTRY_URI,
      RAPTOR_OPTION_PREFIX_ELEMENTS,
      RAPTOR_OPTION_STRICT,
      RAPTOR_OPTION_WWW_CERT_FILENAME,
      RAPTOR_OPTION_WWW_CERT_TYPE,
      RAPTOR_OPTION_WWW_CERT_PASSPHRASE,
      RAPTOR_OPTION_NO_FILE,
      RAPTOR_OPTION_WWW_SSL_VERIFY_PEER,
      RAPTOR_OPTION_WWW_SSL_VERIFY_HOST,
      RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES,
      RAPTOR_OPTION_LAST = RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES
    } raptor_option;

Raptor parser, serializer or XML writer options.

`RAPTOR_OPTION_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_OPTION_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_OPTION_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_OPTION_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_OPTION_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_OPTION_NORMALIZE_LANGUAGE` | If true (default true) then XML language values such as from xml:lang will be normalized to lowercase.
`RAPTOR_OPTION_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_OPTION_WARN_OTHER_PARSETYPES` | If true (default true) then the RDF/XML parser will warn about unknown rdf:parseType values.
`RAPTOR_OPTION_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_OPTION_RELATIVE_URIS` | If true (default true) then relative URIs will be used wherever possible when serializing.
`RAPTOR_OPTION_WRITER_AUTO_INDENT` | Automatically indent elements when seriailizing.
`RAPTOR_OPTION_WRITER_AUTO_EMPTY` | Automatically detect and abbreviate empty elements when serializing.
`RAPTOR_OPTION_WRITER_INDENT_WIDTH` | Integer number of spaces to use for each indent level when serializing with auto indent.
`RAPTOR_OPTION_WRITER_XML_VERSION` | Integer XML version XML 1.0 (10) or XML 1.1 (11)
`RAPTOR_OPTION_WRITER_XML_DECLARATION` | Write XML 1.0 or 1.1 declaration.
`RAPTOR_OPTION_NO_NET` | Deny network requests inside other requests.
`RAPTOR_OPTION_RESOURCE_BORDER` | Border color of resource nodes for GraphViz DOT serializer.
`RAPTOR_OPTION_LITERAL_BORDER` | Border color of literal nodes for GraphViz DOT serializer.
`RAPTOR_OPTION_BNODE_BORDER` | Border color of blank nodes for GraphViz DOT serializer.
`RAPTOR_OPTION_RESOURCE_FILL` | Fill color of resource nodes for GraphViz DOT serializer.
`RAPTOR_OPTION_LITERAL_FILL` | Fill color of literal nodes for GraphViz DOT serializer.
`RAPTOR_OPTION_BNODE_FILL` | Fill color of blank nodes for GraphViz DOT serializer.
`RAPTOR_OPTION_HTML_TAG_SOUP` | Use a lax HTML parser if an XML parser fails when read HTML for GRDDL parser.
`RAPTOR_OPTION_MICROFORMATS` | Look for microformats for GRDDL parser.
`RAPTOR_OPTION_HTML_LINK` | Look for head <link> to type rdf/xml for GRDDL parser.
`RAPTOR_OPTION_WWW_TIMEOUT` | Set timeout for internal WWW URI requests for GRDDL parser.
`RAPTOR_OPTION_WRITE_BASE_URI` | Write `base` directive for Turtle/N3.
`RAPTOR_OPTION_WWW_HTTP_CACHE_CONTROL` | HTTP Cache-Control: header
`RAPTOR_OPTION_WWW_HTTP_USER_AGENT` | HTTP User-Agent: header
`RAPTOR_OPTION_JSON_CALLBACK` | JSON serializer callback function.
`RAPTOR_OPTION_JSON_EXTRA_DATA` | JSON serializer extra top-level data
`RAPTOR_OPTION_RSS_TRIPLES` | Atom/RSS serializer writes extra RDF triples it finds (none, rdf-xml, atom-triples)
`RAPTOR_OPTION_ATOM_ENTRY_URI` | Atom entry URI. If given, generate an Atom Entry Document with the item having the given URI, otherwise generate an Atom Feed Document with any items found.
`RAPTOR_OPTION_PREFIX_ELEMENTS` | Integer. If set, generate Atom/RSS1.0 documents with prefixed elements, otherwise unprefixed.
`RAPTOR_OPTION_STRICT` | Boolean. If set, operate in strict conformance mode.
`RAPTOR_OPTION_WWW_CERT_FILENAME` | String. SSL client certificate filename
`RAPTOR_OPTION_WWW_CERT_TYPE` | String. SSL client certificate type
`RAPTOR_OPTION_WWW_CERT_PASSPHRASE` | String. SSL client certificate passphrase
`RAPTOR_OPTION_NO_FILE` | Deny file reading requests inside other requests.
`RAPTOR_OPTION_WWW_SSL_VERIFY_PEER` | Integer. SSL verify peer - non-0 to verify peer SSL certificate (default)
`RAPTOR_OPTION_WWW_SSL_VERIFY_HOST` | Integer. SSL verify host - 0 none, 1 CN match, 2 host match (default). Other values are ignored.
`RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES` | When reading XML, load external entities.
`RAPTOR_OPTION_LAST` | Internal

### raptor_option_description

    typedef struct {
      raptor_domain domain;
      raptor_option option;
      raptor_option_value_type value_type;
      const char* name;
      size_t name_len;
      const char* label;
      raptor_uri* uri;
    } raptor_option_description;

Description of an option for a domain.

raptor_domain `domain`; | domain ID
raptor_option `option`; | option ID
raptor_option_value_type `value_type`; | data type of option value
const char *`name`; | short name for option
size_t `name_len`; | length of `name`
const char *`label`; | description of option
raptor_uri *`uri`; | URI identifying option

### raptor_option_get_count ()

    unsigned int        raptor_option_get_count             (void);

Get the count of options defined.

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

Returns : | count of options in the raptor_option enumeration

### enum raptor_option_value_type

    typedef enum {
      RAPTOR_OPTION_VALUE_TYPE_BOOL,
      RAPTOR_OPTION_VALUE_TYPE_INT,
      RAPTOR_OPTION_VALUE_TYPE_STRING,
      RAPTOR_OPTION_VALUE_TYPE_URI,
      RAPTOR_OPTION_VALUE_TYPE_LAST = RAPTOR_OPTION_VALUE_TYPE_URI
    } raptor_option_value_type;

Option value types.

`RAPTOR_OPTION_VALUE_TYPE_BOOL` | Boolean integer value. Non-0 is true
`RAPTOR_OPTION_VALUE_TYPE_INT` | Decimal integer value
`RAPTOR_OPTION_VALUE_TYPE_STRING` | String value
`RAPTOR_OPTION_VALUE_TYPE_URI` | URI String value.
`RAPTOR_OPTION_VALUE_TYPE_LAST` | internal

### raptor_option_get_value_type_label ()

    const char *        raptor_option_get_value_type_label  (const raptor_option_value_type type);

Get a label for a value type

`type` : | value type
Returns : | label for type or NULL for invalid type

### raptor_world_get_option_description ()

    raptor_option_description * raptor_world_get_option_description
                                                            (raptor_world *world,
                                                             const raptor_domain domain,
                                                             const raptor_option option);

Get a description of an option for a domain.

The returned description must be freed with `raptor_free_option_description()`.

`world` : | raptor world object
`domain` : | domain
`option` : | option enumeration (0+)
Returns : | option description or NULL on failure or if option is unknown

### raptor_free_option_description ()

    void                raptor_free_option_description      (raptor_option_description *option_description);

Destructor - free an option description object.

`option_description` : | option description

### raptor_world_get_option_from_uri ()

    raptor_option       raptor_world_get_option_from_uri    (raptor_world *world,
                                                             raptor_uri *uri);

Get an option ID from a URI

Option URIs are the concatenation of the string "http://feature.librdf.org/raptor-" plus the short name.

They are automatically returned for any option described with `raptor_world_get_option_description()`.

`world` : | raptor_world instance
`uri` : | option URI
Returns : | < 0 if the option is unknown or on error