Top |
raptor_namespace * | raptor_new_namespace_from_uri () |
raptor_namespace_stack * | raptor_new_namespaces () |
int | raptor_namespaces_init () |
void | raptor_namespaces_clear () |
void | raptor_free_namespaces () |
void | raptor_namespaces_start_namespace () |
int | raptor_namespaces_start_namespace_full () |
void | raptor_namespaces_end_for_depth () |
raptor_namespace * | raptor_namespaces_get_default_namespace () |
raptor_namespace * | raptor_namespaces_find_namespace () |
raptor_namespace * | raptor_namespaces_find_namespace_by_uri () |
int | raptor_namespaces_namespace_in_scope () |
raptor_namespace * | raptor_new_namespace () |
void | raptor_free_namespace () |
raptor_uri * | raptor_namespace_get_uri () |
const unsigned char * | raptor_namespace_get_prefix () |
const unsigned char * | raptor_namespace_get_counted_prefix () |
int | raptor_namespace_write () |
int | raptor_namespace_stack_start_namespace () |
unsigned char * | raptor_namespace_format_as_xml () |
int | raptor_xml_namespace_string_parse () |
raptor_namespace * raptor_new_namespace_from_uri (raptor_namespace_stack *nstack
,const char *prefix
,raptor_uri *ns_uri
,int depth
);
Constructor - create a new namespace from a prefix and URI object.
This declares but does not enable the namespace declaration (or 'start' it)
Use raptor_namespaces_start_namespace()
to make the namespace
enabled and in scope for binding prefixes.
Alternatively use raptor_namespaces_start_namespace_full()
can construct
and enable a namespace in one call.
raptor_namespace_stack * raptor_new_namespaces (raptor_world *world
,int defaults
);
Constructor - create a new raptor_namespace_stack.
See raptor_namespaces_init()
for the values of defaults
.
int raptor_namespaces_init (raptor_world *world
,raptor_namespace_stack *nstack
,int defaults
);
Initialise an existing namespaces stack object
This sets up the stack optionally with some common RDF namespaces.
defaults
can be 0 for none, 1 for just XML, 2 for RDF, RDFS, OWL
and XSD (RDQL uses this) or 3+ undefined.
world |
raptor_world object |
|
nstack |
raptor_namespace_stack to initialise |
|
defaults |
namespaces to initialise. |
void
raptor_namespaces_clear (raptor_namespace_stack *nstack
);
Empty a namespace stack of namespaces and any other resources.
void
raptor_free_namespaces (raptor_namespace_stack *nstack
);
Destructor - destroy a namespace stack
void raptor_namespaces_start_namespace (raptor_namespace_stack *nstack
,raptor_namespace *nspace
);
Start a namespace on a stack of namespaces.
int raptor_namespaces_start_namespace_full (raptor_namespace_stack *nstack
,const char *prefix
,const unsigned char *ns_uri_string
,int depth
);
Create a new namespace and start it on a stack of namespaces.
See raptor_new_namespace()
for the meanings of prefix
,
ns_uri_string
and depth
for namespaces.
void raptor_namespaces_end_for_depth (raptor_namespace_stack *nstack
,int depth
);
End all namespaces at the given depth in the namespace stack.
raptor_namespace *
raptor_namespaces_get_default_namespace
(raptor_namespace_stack *nstack
);
Get the current default namespace in-scope in a stack.
raptor_namespace * raptor_namespaces_find_namespace (raptor_namespace_stack *nstack
,const char *prefix
,int prefix_length
);
Find a namespace in a namespace stack by prefix.
Note that this uses the length
so that the prefix may be a prefix (sic)
of a longer string. If prefix
is NULL, the default namespace will
be returned if present, prefix_length
length is ignored in this case.
raptor_namespace * raptor_namespaces_find_namespace_by_uri (raptor_namespace_stack *nstack
,raptor_uri *ns_uri
);
Find a namespace in a namespace stack by namespace URI.
int raptor_namespaces_namespace_in_scope (raptor_namespace_stack *nstack
,const raptor_namespace *nspace
);
Test if a given namespace is in-scope in the namespace stack.
raptor_namespace * raptor_new_namespace (raptor_namespace_stack *nstack
,const char *prefix
,const unsigned char *ns_uri_string
,int depth
);
Constructor - create a new namespace from a prefix and URI string with a depth scope.
This declares but does not enable the namespace declaration (or 'start' it)
Use raptor_namespaces_start_namespace()
to make the namespace
enabled and in scope for binding prefixes.
Alternatively use raptor_namespaces_start_namespace_full()
can construct
and enable a namespace in one call.
The depth
is a way to use the stack of namespaces for providing scoped
namespaces where inner scope namespaces override outer scope namespaces.
This is primarily for RDF/XML and XML syntaxes that have hierarchical
elements. The main use of this is raptor_namespaces_end_for_depth()
to disable ('end') all namespaces at a given depth. Otherwise set this
to 0.
void
raptor_free_namespace (raptor_namespace *ns
);
Destructor - destroy a namespace.
raptor_uri *
raptor_namespace_get_uri (const raptor_namespace *ns
);
Get the namespace URI.
const unsigned char *
raptor_namespace_get_prefix (const raptor_namespace *ns
);
Get the namespace prefix.
const unsigned char * raptor_namespace_get_counted_prefix (const raptor_namespace *ns
,size_t *length_p
);
Get the namespace prefix and length.
int raptor_namespace_write (raptor_namespace *ns
,raptor_iostream *iostr
);
Write a formatted namespace to an iostream
int raptor_namespace_stack_start_namespace (raptor_namespace_stack *nstack
,raptor_namespace *ns
,int new_depth
);
Copy an existing namespace to a namespace stack with a new depth and start it.
The depth
is a way to use the stack of namespaces for providing scoped
namespaces where inner scope namespaces override outer scope namespaces.
This is primarily for RDF/XML and XML syntaxes that have hierarchical
elements. The main use of this is raptor_namespaces_end_for_depth()
to disable ('end') all namespaces at a given depth. If depths are
not being needed it is unlikely this call is ever needed to copy an
existing namespace at a new depth.
unsigned char * raptor_namespace_format_as_xml (const raptor_namespace *ns
,size_t *length_p
);
Format a namespace in an XML style into a newly allocated string.
Generates a string of the form xmlns:prefix="uri", xmlns="uri", xmlns:prefix="" or xmlns="" depending on the namespace's prefix or URI. Double quotes are always used.
If length_p
is not NULL, the length of the string is
stored in the address it points to.
See also raptor_xml_namespace_string_parse()
int raptor_xml_namespace_string_parse (const char *string
,unsigned char **prefix
,unsigned char **uri_string
);
Parse a string containing an XML style namespace declaration into a namespace prefix and URI pair.
The string is of the form xmlns:prefix="uri", xmlns="uri", xmlns:prefix="" or xmlns="". The quotes can be single or double quotes.
Two values are returned from this function into *prefix
and
*uri_string
. Either but not both may be NULL.
See also raptor_namespace_format_as_xml()