Initialisation

## Initialisation Initialisation — Library startup, shutdown and configuration. |

## Synopsis

    void                raptor_init                         (void);
    void                raptor_finish                       (void);
    typedef             raptor_world;
    raptor_world*       raptor_new_world                    (void);
    void                raptor_free_world                   (raptor_world *world);
    enum                raptor_libxml_flags;
    void                raptor_world_set_libxml_flags       (raptor_world *world,
                                                             int flags);
    void                raptor_world_set_libxslt_security_preferences
                                                            (raptor_world *world,
                                                             void *security_preferences);
    int                 raptor_world_open                   (raptor_world *world);

## Description

How to initialise and terminate the library, set library-wide configuration flags and options.

## Details

### raptor_init ()

    void                raptor_init                         (void);

Initialise the raptor library.

This function MUST be called before using any of the raptor APIs.

### raptor_finish ()

    void                raptor_finish                       (void);

Terminate the raptor library.

Cleans up state of the library. If called, must be used after all other objects are destroyed with their destructor.

### raptor_world

    typedef struct raptor_world_s raptor_world;

Raptor world class.

### raptor_new_world ()

    raptor_world*       raptor_new_world                    (void);

Allocate a new raptor_world object.

The raptor_world is initialized with `raptor_world_open()`. Allocation and initialization are decoupled to allow changing settings on the world object before init.

Returns : | uninitialized raptor_world object or NULL on failure

### raptor_free_world ()

    void                raptor_free_world                   (raptor_world *world);

Terminate the raptor library.

Destroys the raptor_world object and all related information.

`world` : | raptor_world object

### enum raptor_libxml_flags

    typedef enum {
      RAPTOR_LIBXML_FLAGS_GENERIC_ERROR_SAVE    = 1,
      RAPTOR_LIBXML_FLAGS_STRUCTURED_ERROR_SAVE = 2
    } raptor_libxml_flags;

libxml library flags

These are used by `raptor_world_set_libxml_flags()` and `raptor_set_libxml_flags()` to control common libxml features.

If any handler saving/restoring is enabled, any existing handler and context is saved before parsing and restored afterwards. Otherwise, no saving/restoring is performed.

`RAPTOR_LIBXML_FLAGS_GENERIC_ERROR_SAVE` | if set - save/restore the libxml generic error handler when parsing (default unset)
`RAPTOR_LIBXML_FLAGS_STRUCTURED_ERROR_SAVE` | if set - save/restore the libxml structured error handler when parsing (default unset)

### raptor_world_set_libxml_flags ()

    void                raptor_world_set_libxml_flags       (raptor_world *world,
                                                             int flags);

Set common libxml library flags

If libxml is compiled into the library, `flags` is a bitmask taking an OR of values defined in raptor_libxml_flags

See the raptor_libxml_flags documentation for full details of what the flags mean.

`world` : | world
`flags` : | libxml flags

### raptor_world_set_libxslt_security_preferences ()

    void                raptor_world_set_libxslt_security_preferences
                                                            (raptor_world *world,
                                                             void *security_preferences);

Set libxslt security preferences policy object

The `security_preferences` object will NOT become owned by raptor_world

If libxslt is compiled into the library, `security_preferences` should be an xsltSecurityPrefsPtr and will be used to call `xsltSetCtxtSecurityPrefs()` when an XSLT engine is initialised.

If libxslt is not compiled in, the object set here is not used.

`world` : | world
`security_preferences` : | security preferences (an xsltSecurityPrefsPtr)

### raptor_world_open ()

    int                 raptor_world_open                   (raptor_world *world);

Initialise the raptor library.

Initializes a raptor_world object created by `raptor_new_world()`. Allocation and initialization are decoupled to allow changing settings on the world object before init.

The initialized world object is used with subsequent raptor API calls.

`world` : | raptor_world object
Returns : | non-0 on failure