The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>XML Namespaces</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.71.0">
<link rel="start" href="index.html" title="Raptor RDF Syntax Parsing and Serializing Library Manual">
<link rel="up" href="reference-manual.html" title="Part&#160;II.&#160;Raptor Reference Manual">
<link rel="prev" href="raptor-section-www.html" title="WWW">
<link rel="next" href="raptor-section-xml-qname.html" title="XML QName">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="introduction.html" title="Raptor Overview">
<link rel="part" href="tutorial.html" title="Part&#160;I.&#160;Raptor Tutorial">
<link rel="chapter" href="tutorial-initialising-finishing.html" title="Initialising and Finishing using the Library">
<link rel="chapter" href="tutorial-querying-functionality.html" title="Listing built-in functionality">
<link rel="chapter" href="tutorial-parsing.html" title="Parsing syntaxes to RDF Triples">
<link rel="chapter" href="tutorial-serializing.html" title="Serializing RDF triples to a syntax">
<link rel="part" href="reference-manual.html" title="Part&#160;II.&#160;Raptor Reference Manual">
<link rel="chapter" href="raptor-parsers.html" title="Parsers in Raptor (syntax to triples)">
<link rel="chapter" href="raptor-serializers.html" title="Serializers in Raptor (triples to syntax)">
<link rel="index" href="ix01.html" title="Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="raptor-section-www.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference-manual.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Raptor RDF Syntax Parsing and Serializing Library Manual</th>
<td><a accesskey="n" href="raptor-section-xml-qname.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2581027" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2637412" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="raptor-section-xml-namespace"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2581027"></a><span class="refentrytitle">XML Namespaces</span>
</h2>
<p>XML Namespaces &#8212; Namespaces in XML include stacks of Namespaces</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">



typedef     <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>;
<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* <a href="raptor-section-xml-namespace.html#raptor-new-namespace-from-uri">raptor_new_namespace_from_uri</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             <a href="raptor-section-uri.html#raptor-uri">raptor_uri</a> *ns_uri,
                                             int depth);
<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a>* <a href="raptor-section-xml-namespace.html#raptor-new-namespaces">raptor_new_namespaces</a>
                                            (<a href="raptor-section-uri.html#raptor-uri-handler">raptor_uri_handler</a> *uri_handler,
                                             void *uri_context,
                                             <a href="raptor-section-general.html#raptor-simple-message-handler">raptor_simple_message_handler</a> error_handler,
                                             void *error_data,
                                             int defaults);
void        <a href="raptor-section-xml-namespace.html#raptor-namespaces-init">raptor_namespaces_init</a>          (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-uri.html#raptor-uri-handler">raptor_uri_handler</a> *uri_handler,
                                             void *uri_context,
                                             <a href="raptor-section-general.html#raptor-simple-message-handler">raptor_simple_message_handler</a> error_handler,
                                             void *error_data,
                                             int defaults);
void        <a href="raptor-section-xml-namespace.html#raptor-namespaces-clear">raptor_namespaces_clear</a>         (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack);
void        <a href="raptor-section-xml-namespace.html#raptor-free-namespaces">raptor_free_namespaces</a>          (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack);
void        <a href="raptor-section-xml-namespace.html#raptor-namespaces-start-namespace">raptor_namespaces_start_namespace</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *nspace);
int         <a href="raptor-section-xml-namespace.html#raptor-namespaces-start-namespace-full">raptor_namespaces_start_namespace_full</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             unsigned char *ns_uri_string,
                                             int depth);
void        <a href="raptor-section-xml-namespace.html#raptor-namespaces-end-for-depth">raptor_namespaces_end_for_depth</a> (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             int depth);
<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* <a href="raptor-section-xml-namespace.html#raptor-namespaces-get-default-namespace">raptor_namespaces_get_default_namespace</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack);
<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* <a href="raptor-section-xml-namespace.html#raptor-namespaces-find-namespace">raptor_namespaces_find_namespace</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             int prefix_length);
<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* <a href="raptor-section-xml-namespace.html#raptor-namespaces-find-namespace-by-uri">raptor_namespaces_find_namespace_by_uri</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-uri.html#raptor-uri">raptor_uri</a> *ns_uri);
int         <a href="raptor-section-xml-namespace.html#raptor-namespaces-namespace-in-scope">raptor_namespaces_namespace_in_scope</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *nspace);
<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* <a href="raptor-section-xml-namespace.html#raptor-new-namespace">raptor_new_namespace</a>      (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             unsigned char *ns_uri_string,
                                             int depth);
void        <a href="raptor-section-xml-namespace.html#raptor-free-namespace">raptor_free_namespace</a>           (<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);
int         <a href="raptor-section-xml-namespace.html#raptor-namespace-copy">raptor_namespace_copy</a>           (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns,
                                             int new_depth);
<a href="raptor-section-uri.html#raptor-uri">raptor_uri</a>* <a href="raptor-section-xml-namespace.html#raptor-namespace-get-uri">raptor_namespace_get_uri</a>        (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);
const unsigned char* <a href="raptor-section-xml-namespace.html#raptor-namespace-get-prefix">raptor_namespace_get_prefix</a>
                                            (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);
const unsigned char* <a href="raptor-section-xml-namespace.html#raptor-namespace-get-counted-prefix">raptor_namespace_get_counted_prefix</a>
                                            (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns,
                                             size_t *length_p);
unsigned char* <a href="raptor-section-xml-namespace.html#raptor-namespaces-format">raptor_namespaces_format</a>     (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns,
                                             size_t *length_p);
int         <a href="raptor-section-xml-namespace.html#raptor-iostream-write-namespace">raptor_iostream_write_namespace</a> (<a href="raptor-section-iostream.html#raptor-iostream">raptor_iostream</a> *iostr,
                                             <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);
int         <a href="raptor-section-xml-namespace.html#raptor-new-namespace-parts-from-string">raptor_new_namespace_parts_from_string</a>
                                            (unsigned char *string,
                                             unsigned char **prefix,
                                             unsigned char **uri_string);
typedef     <a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a>;
<a href="raptor-section-xml-qname.html#raptor-qname">raptor_qname</a>* <a href="raptor-section-xml-namespace.html#raptor-namespaces-qname-from-uri">raptor_namespaces_qname_from_uri</a>
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-uri.html#raptor-uri">raptor_uri</a> *uri,
                                             int xml_version);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2637412"></a><h2>Description</h2>
<p>
Two classes that provide an XML namespace - short prefix (or none) and
absolute URI (or none) to match the form <code class="literal">xmlns...="..."</code>
seen in XML.  A stack of namespaces <a href="raptor-section-xml-namespace.html#raptor-namespace-stack"><span class="type">raptor_namespace_stack</span></a> is also
provided to handle in-scope namespace calculations that happen inside
XML documents where inner namespaces can override outer ones.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2637445"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2637456"></a><h3>
<a name="raptor-namespace"></a>raptor_namespace</h3>
<a class="indexterm" name="id2637468"></a><pre class="programlisting">raptor_namespace* raptor_namespace;
</pre>
<p>
Raptor XML Namespace class</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2637488"></a><h3>
<a name="raptor-new-namespace-from-uri"></a>raptor_new_namespace_from_uri ()</h3>
<a class="indexterm" name="id2637499"></a><pre class="programlisting"><a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* raptor_new_namespace_from_uri
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             <a href="raptor-section-uri.html#raptor-uri">raptor_uri</a> *ns_uri,
                                             int depth);</pre>
<p>
Constructor - create a new namespace from a prefix and URI object.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>prefix</code></em>&#160;:</span></td>
<td> namespace prefix string
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ns_uri</code></em>&#160;:</span></td>
<td> namespace URI
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>depth</code></em>&#160;:</span></td>
<td> depth of namespace in the stack
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="raptor-section-xml-namespace.html#raptor-namespace"><span class="type">raptor_namespace</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2637630"></a><h3>
<a name="raptor-new-namespaces"></a>raptor_new_namespaces ()</h3>
<a class="indexterm" name="id2631277"></a><pre class="programlisting"><a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a>* raptor_new_namespaces
                                            (<a href="raptor-section-uri.html#raptor-uri-handler">raptor_uri_handler</a> *uri_handler,
                                             void *uri_context,
                                             <a href="raptor-section-general.html#raptor-simple-message-handler">raptor_simple_message_handler</a> error_handler,
                                             void *error_data,
                                             int defaults);</pre>
<p>
Constructor - create a new <a href="raptor-section-xml-namespace.html#raptor-namespace-stack"><span class="type">raptor_namespace_stack</span></a>.
</p>
<p>
See <a href="raptor-section-xml-namespace.html#raptor-namespaces-init"><code class="function">raptor_namespaces_init()</code></a> fo the values of <em class="parameter"><code>defaults</code></em>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>uri_handler</code></em>&#160;:</span></td>
<td> URI handler function
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri_context</code></em>&#160;:</span></td>
<td> URI handler context data
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>error_handler</code></em>&#160;:</span></td>
<td> error handler function
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>error_data</code></em>&#160;:</span></td>
<td> erorr handler data
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>defaults</code></em>&#160;:</span></td>
<td> namespaces to initialise
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new namespace stack or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2631446"></a><h3>
<a name="raptor-namespaces-init"></a>raptor_namespaces_init ()</h3>
<a class="indexterm" name="id2631458"></a><pre class="programlisting">void        raptor_namespaces_init          (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-uri.html#raptor-uri-handler">raptor_uri_handler</a> *uri_handler,
                                             void *uri_context,
                                             <a href="raptor-section-general.html#raptor-simple-message-handler">raptor_simple_message_handler</a> error_handler,
                                             void *error_data,
                                             int defaults);</pre>
<p>
Initialise a namespaces stack some optional common namespaces.
</p>
<p>
<em class="parameter"><code>defaults</code></em> can be 0 for none, 1 for just XML, 2 for RDF, RDFS, OWL
and XSD (RDQL uses this) or 3+ undefined.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> <a href="raptor-section-xml-namespace.html#raptor-namespace-stack"><span class="type">raptor_namespace_stack</span></a> to initialise
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri_handler</code></em>&#160;:</span></td>
<td> URI handler function
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri_context</code></em>&#160;:</span></td>
<td> context for URI handler
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>error_handler</code></em>&#160;:</span></td>
<td> error handler function
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>error_data</code></em>&#160;:</span></td>
<td> context for error handler
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>defaults</code></em>&#160;:</span></td>
<td> namespaces to initialise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641350"></a><h3>
<a name="raptor-namespaces-clear"></a>raptor_namespaces_clear ()</h3>
<a class="indexterm" name="id2641360"></a><pre class="programlisting">void        raptor_namespaces_clear         (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack);</pre>
<p>
Empty a namespace stack of namespaces and any other resources.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641405"></a><h3>
<a name="raptor-free-namespaces"></a>raptor_free_namespaces ()</h3>
<a class="indexterm" name="id2641416"></a><pre class="programlisting">void        raptor_free_namespaces          (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack);</pre>
<p>
Destructor - destroy a namespace stack</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641460"></a><h3>
<a name="raptor-namespaces-start-namespace"></a>raptor_namespaces_start_namespace ()</h3>
<a class="indexterm" name="id2641473"></a><pre class="programlisting">void        raptor_namespaces_start_namespace
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *nspace);</pre>
<p>
Start a namespace on a stack of namespaces.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>nspace</code></em>&#160;:</span></td>
<td> namespace to start
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641542"></a><h3>
<a name="raptor-namespaces-start-namespace-full"></a>raptor_namespaces_start_namespace_full ()</h3>
<a class="indexterm" name="id2641556"></a><pre class="programlisting">int         raptor_namespaces_start_namespace_full
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             unsigned char *ns_uri_string,
                                             int depth);</pre>
<p>
Create a new namespace and start it on a stack of namespaces.
</p>
<p>
See <a href="raptor-section-xml-namespace.html#raptor-new-namespace"><code class="function">raptor_new_namespace()</code></a> for the meanings of <em class="parameter"><code>prefix</code></em>,
<em class="parameter"><code>ns_uri_string</code></em> and <em class="parameter"><code>depth</code></em> for namespaces.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>prefix</code></em>&#160;:</span></td>
<td> new namespace prefix (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ns_uri_string</code></em>&#160;:</span></td>
<td> new namespace URI (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>depth</code></em>&#160;:</span></td>
<td> new namespace depth
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non-0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641713"></a><h3>
<a name="raptor-namespaces-end-for-depth"></a>raptor_namespaces_end_for_depth ()</h3>
<a class="indexterm" name="id2641726"></a><pre class="programlisting">void        raptor_namespaces_end_for_depth (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             int depth);</pre>
<p>
End all namespaces at the given depth in the namespace stack.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>depth</code></em>&#160;:</span></td>
<td> depth
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641798"></a><h3>
<a name="raptor-namespaces-get-default-namespace"></a>raptor_namespaces_get_default_namespace ()</h3>
<a class="indexterm" name="id2641811"></a><pre class="programlisting"><a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* raptor_namespaces_get_default_namespace
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack);</pre>
<p>
Get the current default namespace in-scope in a stack.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="raptor-section-xml-namespace.html#raptor-namespace"><span class="type">raptor_namespace</span></a> or NULL if no default namespace is in scope
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2641882"></a><h3>
<a name="raptor-namespaces-find-namespace"></a>raptor_namespaces_find_namespace ()</h3>
<a class="indexterm" name="id2641895"></a><pre class="programlisting"><a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* raptor_namespaces_find_namespace
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             int prefix_length);</pre>
<p>
Find a namespace in a namespace stack by prefix.
</p>
<p>
Note that this uses the <em class="parameter"><code>length</code></em> so that the prefix may be a prefix (sic)
of a longer string.  If <em class="parameter"><code>prefix</code></em> is NULL, the default namespace will
be returned if present, <em class="parameter"><code>prefix_length</code></em> length is ignored in this case.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>prefix</code></em>&#160;:</span></td>
<td> namespace prefix to find
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>prefix_length</code></em>&#160;:</span></td>
<td> length of prefix.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="raptor-section-xml-namespace.html#raptor-namespace"><span class="type">raptor_namespace</span></a> for the prefix or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642030"></a><h3>
<a name="raptor-namespaces-find-namespace-by-uri"></a>raptor_namespaces_find_namespace_by_uri ()</h3>
<a class="indexterm" name="id2642044"></a><pre class="programlisting"><a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* raptor_namespaces_find_namespace_by_uri
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-uri.html#raptor-uri">raptor_uri</a> *ns_uri);</pre>
<p>
Find a namespace in a namespace stack by namespace URI.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ns_uri</code></em>&#160;:</span></td>
<td> namespace URI to find
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="raptor-section-xml-namespace.html#raptor-namespace"><span class="type">raptor_namespace</span></a> for the URI or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642135"></a><h3>
<a name="raptor-namespaces-namespace-in-scope"></a>raptor_namespaces_namespace_in_scope ()</h3>
<a class="indexterm" name="id2642148"></a><pre class="programlisting">int         raptor_namespaces_namespace_in_scope
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *nspace);</pre>
<p>
Test if a given namespace is in-scope in the namespace stack.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>nspace</code></em>&#160;:</span></td>
<td> namespace
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non-0 if the namespace is in scope.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642200"></a><h3>
<a name="raptor-new-namespace"></a>raptor_new_namespace ()</h3>
<a class="indexterm" name="id2642211"></a><pre class="programlisting"><a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a>* raptor_new_namespace      (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             unsigned char *prefix,
                                             unsigned char *ns_uri_string,
                                             int depth);</pre>
<p>
Constructor - create a new namespace from a prefix and URI string.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>prefix</code></em>&#160;:</span></td>
<td> namespace prefix string
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ns_uri_string</code></em>&#160;:</span></td>
<td> namespace URI string
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>depth</code></em>&#160;:</span></td>
<td> depth of namespace in the stack
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="raptor-section-xml-namespace.html#raptor-namespace"><span class="type">raptor_namespace</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642329"></a><h3>
<a name="raptor-free-namespace"></a>raptor_free_namespace ()</h3>
<a class="indexterm" name="id2642340"></a><pre class="programlisting">void        raptor_free_namespace           (<a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);</pre>
<p>
Destructor - destroy a namespace.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace object
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642384"></a><h3>
<a name="raptor-namespace-copy"></a>raptor_namespace_copy ()</h3>
<a class="indexterm" name="id2642395"></a><pre class="programlisting">int         raptor_namespace_copy           (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns,
                                             int new_depth);</pre>
<p>
Copy a namespace to a new namespace stack with a new depth.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>new_depth</code></em>&#160;:</span></td>
<td> new depth
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non-0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642487"></a><h3>
<a name="raptor-namespace-get-uri"></a>raptor_namespace_get_uri ()</h3>
<a class="indexterm" name="id2642497"></a><pre class="programlisting"><a href="raptor-section-uri.html#raptor-uri">raptor_uri</a>* raptor_namespace_get_uri        (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);</pre>
<p>
Get the namespace URI.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> namespace URI or NULL
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642551"></a><h3>
<a name="raptor-namespace-get-prefix"></a>raptor_namespace_get_prefix ()</h3>
<a class="indexterm" name="id2642562"></a><pre class="programlisting">const unsigned char* raptor_namespace_get_prefix
                                            (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);</pre>
<p>
Get the namespace prefix.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> prefix string or NULL
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642617"></a><h3>
<a name="raptor-namespace-get-counted-prefix"></a>raptor_namespace_get_counted_prefix ()</h3>
<a class="indexterm" name="id2642630"></a><pre class="programlisting">const unsigned char* raptor_namespace_get_counted_prefix
                                            (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns,
                                             size_t *length_p);</pre>
<p>
Get the namespace prefix and length.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length_p</code></em>&#160;:</span></td>
<td> pointer to store length or NULL
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> prefix string or NULL
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642705"></a><h3>
<a name="raptor-namespaces-format"></a>raptor_namespaces_format ()</h3>
<a class="indexterm" name="id2642716"></a><pre class="programlisting">unsigned char* raptor_namespaces_format     (const <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns,
                                             size_t *length_p);</pre>
<p>
Format a namespace in an XML style into a newly allocated string.
</p>
<p>
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.
</p>
<p>
If <em class="parameter"><code>length_p</code></em> is not NULL, the length of the string is
stored in the address it points to.
</p>
<p>
See also <a href="raptor-section-xml-namespace.html#raptor-new-namespace-parts-from-string"><code class="function">raptor_new_namespace_parts_from_string()</code></a></p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length_p</code></em>&#160;:</span></td>
<td> pointer to length (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> namespace formatted as newly allocated string or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642820"></a><h3>
<a name="raptor-iostream-write-namespace"></a>raptor_iostream_write_namespace ()</h3>
<a class="indexterm" name="id2642832"></a><pre class="programlisting">int         raptor_iostream_write_namespace (<a href="raptor-section-iostream.html#raptor-iostream">raptor_iostream</a> *iostr,
                                             <a href="raptor-section-xml-namespace.html#raptor-namespace">raptor_namespace</a> *ns);</pre>
<p>
Write a formatted namespace to an iostream</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>iostr</code></em>&#160;:</span></td>
<td> raptor iosteram
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ns</code></em>&#160;:</span></td>
<td> namespace to write
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non-0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2642906"></a><h3>
<a name="raptor-new-namespace-parts-from-string"></a>raptor_new_namespace_parts_from_string ()</h3>
<a class="indexterm" name="id2642919"></a><pre class="programlisting">int         raptor_new_namespace_parts_from_string
                                            (unsigned char *string,
                                             unsigned char **prefix,
                                             unsigned char **uri_string);</pre>
<p>
Parse a string containin an XML style namespace declaration
into a namespace prefix and URI.
</p>
<p>
The string is of the form xmlns:prefix="uri",
xmlns="uri", xmlns:prefix="" or xmlns="".
The quotes can be single or double quotes.
</p>
<p>
Two values are returned from this function into *<em class="parameter"><code>prefix</code></em> and
*<em class="parameter"><code>uri_string</code></em> neither of which may be NULL.
</p>
<p>
See also <a href="raptor-section-xml-namespace.html#raptor-namespaces-format"><code class="function">raptor_namespaces_format()</code></a></p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>string</code></em>&#160;:</span></td>
<td> string to parse
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>prefix</code></em>&#160;:</span></td>
<td> pointer to location to store namespace prefix
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri_string</code></em>&#160;:</span></td>
<td> pointer to location to store namespace URI
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non-0 on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2643047"></a><h3>
<a name="raptor-namespace-stack"></a>raptor_namespace_stack</h3>
<a class="indexterm" name="id2643058"></a><pre class="programlisting">raptor_namespace_stack* raptor_namespace_stack;
</pre>
<p>
Raptor XML Namespace Stack class</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2643076"></a><h3>
<a name="raptor-namespaces-qname-from-uri"></a>raptor_namespaces_qname_from_uri ()</h3>
<a class="indexterm" name="id2643088"></a><pre class="programlisting"><a href="raptor-section-xml-qname.html#raptor-qname">raptor_qname</a>* raptor_namespaces_qname_from_uri
                                            (<a href="raptor-section-xml-namespace.html#raptor-namespace-stack">raptor_namespace_stack</a> *nstack,
                                             <a href="raptor-section-uri.html#raptor-uri">raptor_uri</a> *uri,
                                             int xml_version);</pre>
<p>
Make an appropriate XML Qname from the namespaces on a namespace stack
</p>
<p>
Makes a qname from the in-scope namespaces in a stack if the URI matches
the prefix and the rest is a legal XML name.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>nstack</code></em>&#160;:</span></td>
<td> namespace stack
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri</code></em>&#160;:</span></td>
<td> URI to use to make qname
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>xml_version</code></em>&#160;:</span></td>
<td> XML Version
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="raptor-section-xml-qname.html#raptor-qname"><span class="type">raptor_qname</span></a> for the URI or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>