Listing built-in functionality

Raptor can be configured and compiled with support for different lists of parsers and serializers. The list built into the library can be found by means of description functions. These take as input an int counter and return descriptions of the object at that offset in the list. The return value is a pointer to a shared, read-only description of the object, or NULL if the counter has gone too far into the list.

Listing Functionality with Descriptions

Get descriptions of the parser syntaxes

  const raptor_syntax_description*
  raptor_world_get_parser_description(raptor_world* world,
                                      unsigned int counter);

Get descriptions of the serializer syntaxes

  const raptor_syntax_description*
  raptor_world_get_serializer_description(raptor_world* world,
                                          unsigned int counter);

Get descriptions of options

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

Call with the appropriate domains for the class such as RAPTOR_DOMAIN_PARSER, RAPTOR_DOMAIN_SERIALIZER etc. See the raptor_domain description for the full list.

These functions can be called directly after creating a raptor world object with raptor_new_world(). This is one way to find a parser (name) by it's MIME Type, the other is to use the mime_type parameter of the raptor_new_parser_for_content().

Example 1. List all parser options using option description

  unsigned int i;
  for(i = 0; i < raptor_option_get_count(); i++) {
    raptor_option_description* od;

    od = raptor_world_get_option_description(world, RAPTOR_DOMAIN_PARSER, i);

    if(od) {
      /* do something with od fields such as od->name, od->label */

There are more examples of this usage in the source for the rapper utility in util/rapper.c.

Navigation: Redland Home Page

Copyright 2000-2014 Dave Beckett