blob: c3dfd7d7151c5d9932ccb57848985b3e650ec0bc [file] [log] [blame]
Daniel Veillardd4330462003-04-29 12:40:16 +00001<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>xmlregexp</title><meta name="generator" content="DocBook XSL Stylesheets V1.58.1"><style xmlns="http://www.w3.org/TR/xhtml1/transitional" type="text/css">
2 .synopsis, .classsynopsis {
3 background: #eeeeee;
4 border: solid 1px #aaaaaa;
5 padding: 0.5em;
6 }
7 .programlisting {
8 background: #eeeeff;
9 border: solid 1px #aaaaff;
10 padding: 0.5em;
11 }
12 .variablelist {
13 padding: 4px;
14 margin-left: 3em;
15 }
16 .navigation {
17 background: #ffeeee;
18 border: solid 1px #ffaaaa;
19 margin-top: 0.5em;
20 margin-bottom: 0.5em;
21 }
22 .navigation a {
23 color: #770000;
24 }
25 .navigation a:visited {
26 color: #550000;
27 }
28 .navigation .title {
29 font-size: 200%;
30 }
31 </style><link rel="home" href="index.html" title="Gnome XML Library Reference Manual"><link rel="up" href="libxml-lib.html" title="Libxml Library Reference"><link rel="previous" href="libxml-xmlmemory.html" title="xmlmemory"><link rel="next" href="libxml-xmlautomata.html" title="xmlautomata"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-xmlmemory.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td><td><a accesskey="u" href="libxml-lib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td><th width="100%" align="center">Gnome XML Library Reference Manual</th><td><a accesskey="n" href="libxml-xmlautomata.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td></tr></table><div class="refentry" lang="en"><a name="libxml-xmlregexp"></a><div class="titlepage"></div><div class="refnamediv"><h2>xmlregexp</h2><p>xmlregexp &#8212; </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
Daniel Veillard80ce3732002-10-07 17:39:30 +000032
Daniel Veillardd4330462003-04-29 12:40:16 +000033
34
35struct <a href="libxml-xmlregexp.html#xmlRegexp">xmlRegexp</a>;
36typedef <a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a>;
37struct <a href="libxml-xmlregexp.html#xmlRegExecCtxt">xmlRegExecCtxt</a>;
38typedef <a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a>;
39<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> <a href="libxml-xmlregexp.html#xmlRegexpCompile">xmlRegexpCompile</a> (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *regexp);
40void <a href="libxml-xmlregexp.html#xmlRegFreeRegexp">xmlRegFreeRegexp</a> (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> regexp);
41int <a href="libxml-xmlregexp.html#xmlRegexpExec">xmlRegexpExec</a> (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> comp,
42 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value);
43void <a href="libxml-xmlregexp.html#xmlRegexpPrint">xmlRegexpPrint</a> (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *output,
44 <a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> regexp);
45int <a href="libxml-xmlregexp.html#xmlRegexpIsDeterminist">xmlRegexpIsDeterminist</a> (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> comp);
46void (<a href="libxml-xmlregexp.html#xmlRegExecCallbacks">*xmlRegExecCallbacks</a>) (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec,
47 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *token,
Daniel Veillard80ce3732002-10-07 17:39:30 +000048 void *transdata,
49 void *inputdata);
Daniel Veillardd4330462003-04-29 12:40:16 +000050<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> <a href="libxml-xmlregexp.html#xmlRegNewExecCtxt">xmlRegNewExecCtxt</a> (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> comp,
51 <a href="libxml-xmlregexp.html#xmlRegExecCallbacks">xmlRegExecCallbacks</a> callback,
Daniel Veillard80ce3732002-10-07 17:39:30 +000052 void *data);
Daniel Veillardd4330462003-04-29 12:40:16 +000053void <a href="libxml-xmlregexp.html#xmlRegFreeExecCtxt">xmlRegFreeExecCtxt</a> (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec);
54int <a href="libxml-xmlregexp.html#xmlRegExecPushString">xmlRegExecPushString</a> (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec,
55 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value,
56 void *data);
57int <a href="libxml-xmlregexp.html#xmlRegExecPushString2">xmlRegExecPushString2</a> (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec,
58 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value,
59 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value2,
60 void *data);
61</pre></div><div class="refsect1" lang="en"><h2>Description</h2><p>
62
63</p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="xmlRegexp"></a>struct xmlRegexp</h3><pre class="programlisting">struct xmlRegexp;</pre><p>
64
Daniel Veillardd7cec922003-06-13 12:30:10 +000065</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegexpPtr"></a>xmlRegexpPtr</h3><pre class="programlisting">typedef xmlRegexp *xmlRegexpPtr;
66</pre><p>
Daniel Veillardd4330462003-04-29 12:40:16 +000067A libxml regular expression, they can actually be far more complex
68thank the POSIX regex expressions.</p><p>
69
70</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegExecCtxt"></a>struct xmlRegExecCtxt</h3><pre class="programlisting">struct xmlRegExecCtxt;</pre><p>
71
Daniel Veillardd7cec922003-06-13 12:30:10 +000072</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegExecCtxtPtr"></a>xmlRegExecCtxtPtr</h3><pre class="programlisting">typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
73</pre><p>
Daniel Veillardd4330462003-04-29 12:40:16 +000074A libxml progressive regular expression evaluation context</p><p>
75
76</p></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegexpCompile"></a>xmlRegexpCompile ()</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> xmlRegexpCompile (const <a href="libxml-tree.html#xmlChar">xmlChar</a> *regexp);</pre><p>
77Parses a regular expression conforming to XML Schemas Part 2 Datatype
Daniel Veillard80ce3732002-10-07 17:39:30 +000078Appendix F and build an automata suitable for testing strings against
Daniel Veillardd4330462003-04-29 12:40:16 +000079that regular expression</p><p>
80
Daniel Veillardd7cec922003-06-13 12:30:10 +000081</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>regexp</tt></i> :</span></td><td> a regular expression string
82</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the compiled expression or NULL in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +000083</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegFreeRegexp"></a>xmlRegFreeRegexp ()</h3><pre class="programlisting">void xmlRegFreeRegexp (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> regexp);</pre><p>
84Free a regexp</p><p>
85
Daniel Veillardd7cec922003-06-13 12:30:10 +000086</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>regexp</tt></i> :</span></td><td> the regexp
Daniel Veillardd4330462003-04-29 12:40:16 +000087</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegexpExec"></a>xmlRegexpExec ()</h3><pre class="programlisting">int xmlRegexpExec (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> comp,
88 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value);</pre><p>
89Check if the regular expression generate the value</p><p>
90
Daniel Veillardd7cec922003-06-13 12:30:10 +000091</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>comp</tt></i> :</span></td><td> the compiled regular expression
Daniel Veillardd4330462003-04-29 12:40:16 +000092</td></tr><tr><td><span class="term"><i><tt>value</tt></i> :</span></td><td>
Daniel Veillardd7cec922003-06-13 12:30:10 +000093</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>1 if it matches, 0 if not and a negativa value in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +000094</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegexpPrint"></a>xmlRegexpPrint ()</h3><pre class="programlisting">void xmlRegexpPrint (<GTKDOCLINK xmlns="http://www.w3.org/TR/xhtml1/transitional" HREF="FILE-CAPS">FILE</GTKDOCLINK> *output,
95 <a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> regexp);</pre><p>
96Print the content of the compiled regular expression</p><p>
97
Daniel Veillardd7cec922003-06-13 12:30:10 +000098</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>output</tt></i> :</span></td><td> the file for the output debug
99</td></tr><tr><td><span class="term"><i><tt>regexp</tt></i> :</span></td><td> the compiled regexp
Daniel Veillardd4330462003-04-29 12:40:16 +0000100</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegexpIsDeterminist"></a>xmlRegexpIsDeterminist ()</h3><pre class="programlisting">int xmlRegexpIsDeterminist (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> comp);</pre><p>
101Check if the regular expression is determinist</p><p>
102
Daniel Veillardd7cec922003-06-13 12:30:10 +0000103</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>comp</tt></i> :</span></td><td> the compiled regular expression
104</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>1 if it yes, 0 if not and a negativa value in case of error
Daniel Veillardd4330462003-04-29 12:40:16 +0000105</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegExecCallbacks"></a>xmlRegExecCallbacks ()</h3><pre class="programlisting">void (*xmlRegExecCallbacks) (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec,
106 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *token,
Daniel Veillard80ce3732002-10-07 17:39:30 +0000107 void *transdata,
Daniel Veillardd4330462003-04-29 12:40:16 +0000108 void *inputdata);</pre><p>
109
110</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>exec</tt></i> :</span></td><td>
111</td></tr><tr><td><span class="term"><i><tt>token</tt></i> :</span></td><td>
112</td></tr><tr><td><span class="term"><i><tt>transdata</tt></i> :</span></td><td>
113</td></tr><tr><td><span class="term"><i><tt>inputdata</tt></i> :</span></td><td>
114
115
116</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegNewExecCtxt"></a>xmlRegNewExecCtxt ()</h3><pre class="programlisting"><a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> xmlRegNewExecCtxt (<a href="libxml-xmlregexp.html#xmlRegexpPtr">xmlRegexpPtr</a> comp,
117 <a href="libxml-xmlregexp.html#xmlRegExecCallbacks">xmlRegExecCallbacks</a> callback,
118 void *data);</pre><p>
119Build a context used for progressive evaluation of a regexp.</p><p>
120
Daniel Veillardd7cec922003-06-13 12:30:10 +0000121</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>comp</tt></i> :</span></td><td> a precompiled regular expression
122</td></tr><tr><td><span class="term"><i><tt>callback</tt></i> :</span></td><td> a callback function used for handling progresses in the
123 automata matching phase
124</td></tr><tr><td><span class="term"><i><tt>data</tt></i> :</span></td><td> the context data associated to the callback in this context
125</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new context
Daniel Veillardd4330462003-04-29 12:40:16 +0000126</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegFreeExecCtxt"></a>xmlRegFreeExecCtxt ()</h3><pre class="programlisting">void xmlRegFreeExecCtxt (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec);</pre><p>
127Free the structures associated to a regular expression evaulation context.</p><p>
128
Daniel Veillardd7cec922003-06-13 12:30:10 +0000129</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>exec</tt></i> :</span></td><td> a regular expression evaulation context
Daniel Veillardd4330462003-04-29 12:40:16 +0000130</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegExecPushString"></a>xmlRegExecPushString ()</h3><pre class="programlisting">int xmlRegExecPushString (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec,
131 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value,
132 void *data);</pre><p>
133Push one input token in the execution context</p><p>
134
Daniel Veillardd7cec922003-06-13 12:30:10 +0000135</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>exec</tt></i> :</span></td><td> a regexp execution context or NULL to indicate the end
136</td></tr><tr><td><span class="term"><i><tt>value</tt></i> :</span></td><td> a string token input
137</td></tr><tr><td><span class="term"><i><tt>data</tt></i> :</span></td><td> data associated to the token to reuse in callbacks
138</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 1 if the regexp reached a final state, 0 if non-final, and
139 a negative value in case of error.
Daniel Veillardd4330462003-04-29 12:40:16 +0000140</td></tr></tbody></table></div></div><hr xmlns="http://www.w3.org/TR/xhtml1/transitional"></hr><div class="refsect2" lang="en"><h3><a name="xmlRegExecPushString2"></a>xmlRegExecPushString2 ()</h3><pre class="programlisting">int xmlRegExecPushString2 (<a href="libxml-xmlregexp.html#xmlRegExecCtxtPtr">xmlRegExecCtxtPtr</a> exec,
141 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value,
142 const <a href="libxml-tree.html#xmlChar">xmlChar</a> *value2,
143 void *data);</pre><p>
144Push one input token in the execution context</p><p>
145
Daniel Veillardd7cec922003-06-13 12:30:10 +0000146</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i><tt>exec</tt></i> :</span></td><td> a regexp execution context or NULL to indicate the end
147</td></tr><tr><td><span class="term"><i><tt>value</tt></i> :</span></td><td> the first string token input
148</td></tr><tr><td><span class="term"><i><tt>value2</tt></i> :</span></td><td> the second string token input
149</td></tr><tr><td><span class="term"><i><tt>data</tt></i> :</span></td><td> data associated to the token to reuse in callbacks
150</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> 1 if the regexp reached a final state, 0 if non-final, and
151 a negative value in case of error.
Daniel Veillardd4330462003-04-29 12:40:16 +0000152</td></tr></tbody></table></div></div></div></div><table xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libxml-xmlmemory.html"><b>&lt;&lt; xmlmemory</b></a></td><td align="right"><a accesskey="n" href="libxml-xmlautomata.html"><b>xmlautomata &gt;&gt;</b></a></td></tr></table></body></html>