summaryrefslogtreecommitdiffstats
path: root/docs/html/tutorial-parser-set-id-handler.html
blob: 4f17805b4579c98d99c4a61f0d159912679abccc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Set the identifier creator handler: Raptor RDF Syntax Library Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="Raptor RDF Syntax Library Manual">
<link rel="up" href="tutorial-parsing.html" title="Parsing syntaxes to RDF Triples">
<link rel="prev" href="tutorial-parser-set-error-warning-handlers.html" title="Set parsing log message handlers">
<link rel="next" href="tutorial-parser-set-namespace-handler.html" title="Set namespace declared handler">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="tutorial-parsing.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="tutorial-parser-set-error-warning-handlers.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="tutorial-parser-set-namespace-handler.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="tutorial-parser-set-id-handler"></a>Set the identifier creator handler</h2></div></div></div>
<p>Identifiers are created in some parsers by generating them
automatically or via hints given a syntax.  Raptor can customise this
process using a user-supplied identifier handler function.
For example, in RDF/XML generated blank node identifiers and those
those specified <code class="literal">rdf:nodeID</code> are passed through this
process.  Setting a handler allows the identifier generation mechanism to be
fully replaced.  A lighter alternative is to use
<a class="link" href="raptor2-section-world.html#raptor-world-set-generate-bnodeid-parameters" title="raptor_world_set_generate_bnodeid_parameters ()"><code class="function">raptor_world_set_generate_bnodeid_parameters()</code></a>
to adjust the default algorithm for generated identifiers.
</p>
<p>It is used as follows
</p>
<pre class="programlisting">
  raptor_generate_bnodeid_handler bnodeid_handler;

  raptor_world_set_generate_bnodeid_handler(rdf_parser, user_data, bnodeid_handler);
</pre>
<p>
</p>
<p>The <span class="emphasis"><em>bnodeid_handler</em></span> takes the following signature:
</p>
<pre class="programlisting">
unsigned char*
generate_id_handler(void* user_data, unsigned char* user_id)
{
   /* return a new generated ID based on user_id (optional) */
}
</pre>
<p>
where <span class="emphasis"><em>user_id</em></span> an optional user-supplied identifier,
such as the value of a <code class="literal">rdf:nodeID</code> in RDF/XML.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>