libxml-pattern.html revision 1822e8ba64abeb15572da12e53b239b6c2119abc
1<?xml version="1.0" encoding="ISO-8859-1"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css"> 4TD {font-family: Verdana,Arial,Helvetica} 5BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em} 6H1 {font-family: Verdana,Arial,Helvetica} 7H2 {font-family: Verdana,Arial,Helvetica} 8H3 {font-family: Verdana,Arial,Helvetica} 9A:link, A:visited, A:active { text-decoration: underline } 10</style><style type="text/css"> 11 div.deprecated pre.programlisting {border-style: double;border-color:red} 12 pre.programlisting {border-style: double;background: #EECFA1} 13 </style><title>Module pattern from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="/epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="/gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="/w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="/redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="/Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module pattern from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="/search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="/index.html">Main Menu</a></li><li><a style="font-weight:bold" href="/docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="/examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="/guidelines.html">XML Guidelines</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="/APIchunk0.html">Alphabetic</a></li><li><a href="/APIconstructors.html">Constructors</a></li><li><a href="/APIfunctions.html">Functions/Types</a></li><li><a href="/APIfiles.html">Modules</a></li><li><a href="/APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-parserInternals.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-parserInternals.html">parserInternals</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="/index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="/index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-relaxng.html">relaxng</a></th><td><a accesskey="n" href="libxml-relaxng.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>allows to compile and test pattern expressions for nodes either in a tree or based on a parser state. </p><h2>Table of Contents</h2><pre class="programlisting">Structure <a href="#xmlPattern">xmlPattern</a><br />struct _xmlPattern 14The content of this structure is not made public by the API. 15</pre><pre class="programlisting">Typedef <a href="libxml-pattern.html#xmlPattern">xmlPattern</a> * <a name="xmlPatternPtr" id="xmlPatternPtr">xmlPatternPtr</a> 16</pre><pre class="programlisting">void <a href="#xmlFreePattern">xmlFreePattern</a> (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)</pre> 17<pre class="programlisting">void <a href="#xmlFreePatternList">xmlFreePatternList</a> (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)</pre> 18<pre class="programlisting">int <a href="#xmlPatternMatch">xmlPatternMatch</a> (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node)</pre> 19<pre class="programlisting"><a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> <a href="#xmlPatterncompile">xmlPatterncompile</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * pattern, <br /> <a href="libxml-dict.html#xmlDict">xmlDict</a> * dict, <br /> int flags, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> ** namespaces)</pre> 20<h2>Description</h2> 21<h3><a name="xmlPattern" id="xmlPattern">Structure xmlPattern</a></h3><pre class="programlisting">Structure xmlPattern<br />struct _xmlPattern { 22The content of this structure is not made public by the API. 23}</pre><h3><a name="xmlFreePattern" id="xmlFreePattern"></a>Function: xmlFreePattern</h3><pre class="programlisting">void xmlFreePattern (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)<br /> 24</pre><p>Free up the memory allocated by @comp</p> 25<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>an XSLT comp</td></tr></tbody></table></div><h3><a name="xmlFreePatternList" id="xmlFreePatternList"></a>Function: xmlFreePatternList</h3><pre class="programlisting">void xmlFreePatternList (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)<br /> 26</pre><p>Free up the memory allocated by all the elements of @comp</p> 27<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>an XSLT comp list</td></tr></tbody></table></div><h3><a name="xmlPatternMatch" id="xmlPatternMatch"></a>Function: xmlPatternMatch</h3><pre class="programlisting">int xmlPatternMatch (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br /> 28</pre><p>Test wether the node matches the pattern</p> 29<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the precompiled pattern</td></tr><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>a node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if it matches, 0 if it doesn't and -1 in case of failure</td></tr></tbody></table></div><h3><a name="xmlPatterncompile" id="xmlPatterncompile"></a>Function: xmlPatterncompile</h3><pre class="programlisting"><a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> xmlPatterncompile (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * pattern, <br /> <a href="libxml-dict.html#xmlDict">xmlDict</a> * dict, <br /> int flags, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> ** namespaces)<br /> 30</pre><p>Compile a pattern.</p> 31<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pattern</tt></i>:</span></td><td>the pattern to compile</td></tr><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>an optional dictionnary for interned strings</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>compilation flags, undefined yet</td></tr><tr><td><span class="term"><i><tt>namespaces</tt></i>:</span></td><td>the prefix definitions, array of [URI, prefix] or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the compiled for of the pattern or NULL in case of error</td></tr></tbody></table></div><p><a href="/bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html> 32