ce1a25fb079fba97b11ef1eb9e6ab18149abaa63
[platform/upstream/libxml2.git] / doc / search.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5 <link rel="SHORTCUT ICON" href="/favicon.ico">
6 <style type="text/css"><!--
7 TD {font-family: Verdana,Arial,Helvetica}
8 BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
9 H1 {font-family: Verdana,Arial,Helvetica}
10 H2 {font-family: Verdana,Arial,Helvetica}
11 H3 {font-family: Verdana,Arial,Helvetica}
12 A:link, A:visited, A:active { text-decoration: underline }
13 --></style>
14 <title>Search the documentation on XMLSoft.org</title>
15 </head>
16 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
17 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr>
18 <td width="180">
19 <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>
20 </td>
21 <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">
22 <h1>The XML C library for Gnome</h1>
23 <h2>Search engine</h2>
24 </td></tr></table></td></tr></table></td>
25 </tr></table>
26 <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>
27 <td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td>
28 <table width="100%" border="0" cellspacing="1" cellpadding="3">
29 <tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr>
30 <tr><td bgcolor="#fffacd"><ul>
31 <li><a href="index.html">Home</a></li>
32 <li><a href="intro.html">Introduction</a></li>
33 <li><a href="FAQ.html">FAQ</a></li>
34 <li><a href="docs.html">Documentation</a></li>
35 <li><a href="bugs.html">Reporting bugs and getting help</a></li>
36 <li><a href="help.html">How to help</a></li>
37 <li><a href="downloads.html">Downloads</a></li>
38 <li><a href="news.html">News</a></li>
39 <li><a href="XMLinfo.html">XML</a></li>
40 <li><a href="XSLT.html">XSLT</a></li>
41 <li><a href="python.html">Python and bindings</a></li>
42 <li><a href="architecture.html">libxml architecture</a></li>
43 <li><a href="tree.html">The tree output</a></li>
44 <li><a href="interface.html">The SAX interface</a></li>
45 <li><a href="xmldtd.html">Validation &amp; DTDs</a></li>
46 <li><a href="xmlmem.html">Memory Management</a></li>
47 <li><a href="encoding.html">Encodings support</a></li>
48 <li><a href="xmlio.html">I/O Interfaces</a></li>
49 <li><a href="catalog.html">Catalog support</a></li>
50 <li><a href="library.html">The parser interfaces</a></li>
51 <li><a href="entities.html">Entities or no entities</a></li>
52 <li><a href="namespaces.html">Namespaces</a></li>
53 <li><a href="upgrade.html">Upgrading 1.x code</a></li>
54 <li><a href="threads.html">Thread safety</a></li>
55 <li><a href="DOM.html">DOM Principles</a></li>
56 <li><a href="example.html">A real example</a></li>
57 <li><a href="contribs.html">Contributions</a></li>
58 <li><a href="tutorial/index.html">Tutorial</a></li>
59 <li>
60 <a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a>
61 </li>
62 </ul></td></tr>
63 </table>
64 <table width="100%" border="0" cellspacing="1" cellpadding="3">
65 <tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr>
66 <tr><td bgcolor="#fffacd"><ul>
67 <li><a href="APIchunk0.html">Alphabetic</a></li>
68 <li><a href="APIconstructors.html">Constructors</a></li>
69 <li><a href="APIfunctions.html">Functions/Types</a></li>
70 <li><a href="APIfiles.html">Modules</a></li>
71 <li><a href="APIsymbols.html">Symbols</a></li>
72 </ul></td></tr>
73 </table>
74 <table width="100%" border="0" cellspacing="1" cellpadding="3">
75 <tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr>
76 <tr><td bgcolor="#fffacd"><ul>
77 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
78 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
79 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
80 <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li>
81 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
82 <li><a href="http://ww.zlatkovic.com/projects/libxml/">Windows binaries</a></li>
83 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
84 <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li>
85 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
86 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&amp;product=libxml2">Bug Tracker</a></li>
87 </ul></td></tr>
88 </table>
89 </td></tr></table></td>
90 <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">
91 <?php
92     $query = $HTTP_GET_VARS[ "query" ];
93     $scope = $HTTP_GET_VARS[ "scope" ];
94     // We handle only the first argument so far
95     $query = $_GET['query'];
96     $query = ltrim ($query);
97     if (! $query) {
98         echo "<h1 align='center'>Search the documentation on XMLSoft.org</h1>";
99     }
100     if ($scope == NULL)
101         $scope = "any";
102     $scope = ltrim ($scope);
103     if ($scope == "")
104         $scope = "any";
105
106 ?>
107 <p> The search service indexes the libxml2 and libxslt APIs and documentation as well as the xml@gnome.org and xslt@gnome.org mailing-list archives. To use it simply provide a set of keywords:
108 <p>
109 <form action="<?php echo "$PHP_SELF", "?query=", rawurlencode($query) ?>"
110       enctype="application/x-www-form-urlencoded" method="GET">
111   <input name="query" type="TEXT" size="50" value="<?php echo $query?>">
112   <select name="scope">
113     <option value="any">Search All</option>
114     <option value="XML" <?php if ($scope == 'XML') print "selected"?>>XML resources</option>
115     <option value="XSLT" <?php if ($scope == 'XSLT') print "selected"?>>XSLT resources</option>
116     <option value="API" <?php if ($scope == 'API') print "selected"?>>Only the APIs</option>
117     <option value="XMLAPI" <?php if ($scope == 'XMLAPI') print "selected"?>>Only the XML API</option>
118     <option value="XSLTAPI" <?php if ($scope == 'XSLTAPI') print "selected"?>>Only the XSLT API</option>
119     <option value="DOCS" <?php if ($scope == 'DOCS') print "selected"?>>Only the Documentation</option>
120     <option value="XMLDOC" <?php if ($scope == 'XMLDOC') print "selected"?>>Only the XML Documentation</option>
121     <option value="XSLTDOC" <?php if ($scope == 'XSLTDOC') print "selected"?>>Only the XSLT Documentation</option>
122     <option value="LISTS" <?php if ($scope == 'LISTS') print "selected"?>>Only the lists archives</option>
123     <option value="XMLLIST" <?php if ($scope == 'XMLLIST') print "selected"?>>Only the XML list archive</option>
124     <option value="XSLTLIST" <?php if ($scope == 'XSLTLIST') print "selected"?>>Only the XSLT list archive</option>
125   </select>
126   <input name=submit type=submit value="Search ...">
127 </form>
128 <?php
129     function logQueryWord($word) {
130         $result = mysql_query ("SELECT ID,Count FROM Queries WHERE Value='$word'");
131         if ($result) {
132             $i = mysql_num_rows($result);
133             if ($i == 0) {
134                 mysql_free_result($result);
135                 mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
136             } else {
137                 $id = mysql_result($result, 0, 0);
138                 $count = mysql_result($result, 0, 1);
139                 $count ++;
140                 mysql_query ("UPDATE Queries SET Count=$count WHERE ID=$id");
141             }
142         } else {
143             mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
144         }
145     }
146     function queryWord($word) {
147         $result = NULL;
148         $j = 0;
149         if ($word) {
150             $result = mysql_query ("SELECT words.relevance, symbols.name, symbols.type, symbols.module, symbols.descr FROM words, symbols WHERE LCASE(words.name) LIKE LCASE('$word') and words.symbol = symbols.name ORDER BY words.relevance DESC LIMIT 75");
151             if ($result) {
152                 $j = mysql_num_rows($result);
153                 if ($j == 0) 
154                     mysql_free_result($result);
155             }
156             logQueryWord($word);
157         }
158         return array($result, $j);
159     }
160     function queryHTMLWord($word) {
161         $result = NULL;
162         $j = 0;
163         if ($word) {
164             $result = mysql_query ("SELECT relevance, name, id, resource, section FROM wordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
165             if ($result) {
166                 $j = mysql_num_rows($result);
167                 if ($j == 0) 
168                     mysql_free_result($result);
169             }
170             logQueryWord($word);
171         }
172         return array($result, $j);
173     }
174     function queryArchiveWord($word) {
175         $result = NULL;
176         $j = 0;
177         if ($word) {
178             $result = mysql_query ("SELECT wordsArchive.relevance, wordsArchive.name, 'xml-list', archives.resource, archives.title FROM wordsArchive, archives WHERE LCASE(wordsArchive.name) LIKE LCASE('$word') and wordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
179             if ($result) {
180                 $j = mysql_num_rows($result);
181                 if ($j == 0) 
182                     mysql_free_result($result);
183             }
184             logQueryWord($word);
185         }
186         return array($result, $j);
187     }
188     function XSLTqueryWord($word) {
189         $result = NULL;
190         $j = 0;
191         if ($word) {
192             $result = mysql_query ("SELECT XSLTwords.relevance, XSLTsymbols.name, XSLTsymbols.type, XSLTsymbols.module, XSLTsymbols.descr FROM XSLTwords, XSLTsymbols WHERE LCASE(XSLTwords.name) LIKE LCASE('$word') and XSLTwords.symbol = XSLTsymbols.name ORDER BY XSLTwords.relevance DESC LIMIT 75");
193             if ($result) {
194                 $j = mysql_num_rows($result);
195                 if ($j == 0) 
196                     mysql_free_result($result);
197             }
198             logQueryWord($word);
199         }
200         return array($result, $j);
201     }
202     function XSLTqueryHTMLWord($word) {
203         $result = NULL;
204         $j = 0;
205         if ($word) {
206             $result = mysql_query ("SELECT relevance, name, id, resource, section FROM XSLTwordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
207             if ($result) {
208                 $j = mysql_num_rows($result);
209                 if ($j == 0) 
210                     mysql_free_result($result);
211             }
212             logQueryWord($word);
213         }
214         return array($result, $j);
215     }
216     function XSLTqueryArchiveWord($word) {
217         $result = NULL;
218         $j = 0;
219         if ($word) {
220             $result = mysql_query ("SELECT XSLTwordsArchive.relevance, XSLTwordsArchive.name, 'xslt-list', archives.resource, archives.title FROM XSLTwordsArchive, archives WHERE LCASE(XSLTwordsArchive.name) LIKE LCASE('$word') and XSLTwordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
221             if ($result) {
222                 $j = mysql_num_rows($result);
223                 if ($j == 0) 
224                     mysql_free_result($result);
225             }
226             logQueryWord($word);
227         }
228         return array($result, $j);
229     }
230     function resSort ($a, $b) {
231         list($ra,$ta,$ma,$na,$da) = $a;
232         list($rb,$tb,$mb,$nb,$db) = $b;
233         if ($ra == $rb) return 0;
234         return ($ra > $rb) ? -1 : 1;
235     }
236     if (($query) && (strlen($query) <= 50)) {
237         $link = mysql_connect ("localhost", "nobody");
238         if (!$link) {
239             echo "<p> Could not connect to the database: ", mysql_error();
240         } else {
241             mysql_select_db("xmlsoft", $link);
242             $list = explode (" ", $query);
243             $results = array();
244             $number = 0;
245             for ($number = 0;$number < count($list);$number++) {
246
247                 $word = $list[$number];
248                 if (($scope == 'any') || ($scope == 'XML') ||
249                     ($scope == 'API') || ($scope == 'XMLAPI')) {
250                     list($result, $j) = queryWord($word);
251                     if ($j > 0) {
252                         for ($i = 0; $i < $j; $i++) {
253                             $relevance = mysql_result($result, $i, 0);
254                             $name = mysql_result($result, $i, 1);
255                             $type = mysql_result($result, $i, 2);
256                             $module = mysql_result($result, $i, 3);
257                             $desc = mysql_result($result, $i, 4);
258                             if (array_key_exists($name, $results)) {
259                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
260                                 $results[$name] = array(($r + $relevance) * 2,
261                                                         $t,$m,$d,$w,$u);
262                             } else {
263                                 $id = $name;
264                                 $m = strtolower($module);
265                                 $url = "html/libxml-$module.html#$id";
266                                 $results[$name] = array($relevance,$type,
267                                                 $module, $desc, $name, $url);
268                             }
269                         }
270                         mysql_free_result($result);
271                     }
272                 }
273                 if (($scope == 'any') || ($scope == 'XSLT') ||
274                     ($scope == 'API') || ($scope == 'XSLTAPI')) {
275                     list($result, $j) = XSLTqueryWord($word);
276                     if ($j > 0) {
277                         for ($i = 0; $i < $j; $i++) {
278                             $relevance = mysql_result($result, $i, 0);
279                             $name = mysql_result($result, $i, 1);
280                             $type = mysql_result($result, $i, 2);
281                             $module = mysql_result($result, $i, 3);
282                             $desc = mysql_result($result, $i, 4);
283                             if (array_key_exists($name, $results)) {
284                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
285                                 $results[$name] = array(($r + $relevance) * 2,
286                                                         $t,$m,$d,$w,$u);
287                             } else {
288                                 $id = $name;
289                                 $m = strtolower($module);
290                                 $url = "XSLT/html/libxslt-$module.html#$id";
291                                 $results[$name] = array($relevance,$type,
292                                                 $module, $desc, $name, $url);
293                             }
294                         }
295                         mysql_free_result($result);
296                     }
297                 }
298                 if (($scope == 'any') || ($scope == 'XML') ||
299                     ($scope == 'DOCS') || ($scope == 'XMLDOC')) {
300                     list($result, $k) = queryHTMLWord($word);
301                     if ($k > 0) {
302                         for ($i = 0; $i < $k; $i++) {
303                             $relevance = mysql_result($result, $i, 0);
304                             $name = mysql_result($result, $i, 1);
305                             $id = mysql_result($result, $i, 2);
306                             $module = mysql_result($result, $i, 3);
307                             $desc = mysql_result($result, $i, 4);
308                             if (strncmp($module, "libxml-", 7) == 0)
309                                 $url = "html/$module";
310                             if ($id != "") {
311                                 $url = $url + "#$id";
312                             }
313                             $results["$name _html_ $number _ $i"] =
314                                           array($relevance, "XML docs",
315                                                 $module, $desc, $name, $url);
316                         }
317                         mysql_free_result($result);
318                     }
319                 }
320                 if (($scope == 'any') || ($scope == 'XSLT') ||
321                     ($scope == 'DOCS') || ($scope == 'XSLTDOC')) {
322                     list($result, $k) = XSLTqueryHTMLWord($word);
323                     if ($k > 0) {
324                         for ($i = 0; $i < $k; $i++) {
325                             $relevance = mysql_result($result, $i, 0);
326                             $name = mysql_result($result, $i, 1);
327                             $id = mysql_result($result, $i, 2);
328                             $module = mysql_result($result, $i, 3);
329                             $desc = mysql_result($result, $i, 4);
330                             $url = "XSLT/$module";
331                             if ($id != "") {
332                                 $url = $url + "#$id";
333                             }
334                             $results["$name xslthtml $number _ $i "] =
335                                           array($relevance, "XSLT docs",
336                                                 $module, $desc, $name, $url);
337                         }
338                         mysql_free_result($result);
339                     }
340                 }
341                 if (($scope == 'any') || ($scope == 'XML') ||
342                     ($scope == 'LISTS') || ($scope == 'XMLLIST')) {
343                     list($result, $j) = queryArchiveWord($word);
344                     if ($j > 0) {
345                         for ($i = 0; $i < $j; $i++) {
346                             $relevance = mysql_result($result, $i, 0);
347                             $name = mysql_result($result, $i, 1);
348                             $type = mysql_result($result, $i, 2);
349                             $url = mysql_result($result, $i, 3);
350                             $desc = mysql_result($result, $i, 4);
351                             if (array_key_exists($url, $results)) {
352                                 list($r,$t,$m,$d,$w,$u) = $results[$url];
353                                 $results[$name] = array(($r + $relevance) * 2,
354                                                         $t,$m,$d,$w,$u);
355                             } else {
356                                 $id = $name;
357                                 $m = strtolower($module);
358                                 $u = str_replace(
359                         "http://mail.gnome.org/archives/xml/", "", $url);
360                                 $results[$url] = array($relevance,$type,
361                                                 $u, $desc, $name, $url);
362                             }
363                         }
364                         mysql_free_result($result);
365                     }
366                 }
367                 if (($scope == 'any') || ($scope == 'XSLT') ||
368                     ($scope == 'LISTS') || ($scope == 'XSLTLIST')) {
369                     list($result, $j) = XSLTqueryArchiveWord($word);
370                     if ($j > 0) {
371                         for ($i = 0; $i < $j; $i++) {
372                             $relevance = mysql_result($result, $i, 0);
373                             $name = mysql_result($result, $i, 1);
374                             $type = mysql_result($result, $i, 2);
375                             $url = mysql_result($result, $i, 3);
376                             $desc = mysql_result($result, $i, 4);
377                             if (array_key_exists($url, $results)) {
378                                 list($r,$t,$m,$d,$w,$u) = $results[$url];
379                                 $results[$name] = array(($r + $relevance) * 2,
380                                                         $t,$m,$d,$w,$u);
381                             } else {
382                                 $id = $name;
383                                 $m = strtolower($module);
384                                 $u = str_replace(
385                         "http://mail.gnome.org/archives/xslt/", "", $url);
386                                 $results[$url] = array($relevance,$type,
387                                                 $u, $desc, $name, $url);
388                             }
389                         }
390                         mysql_free_result($result);
391                     }
392                 }
393             }
394             if ((count($results) == 0) && (count($list) == 1)) {
395                 $word = $list[0];
396                 if (($scope == 'any') || ($scope == 'XML') ||
397                     ($scope == 'API') || ($scope == 'XMLAPI')) {
398                     list($result, $j) = queryWord("xml$word");
399                     if ($j > 0) {
400                         for ($i = 0; $i < $j; $i++) {
401                             $relevance = mysql_result($result, $i, 0);
402                             $name = mysql_result($result, $i, 1);
403                             $type = mysql_result($result, $i, 2);
404                             $module = mysql_result($result, $i, 3);
405                             $desc = mysql_result($result, $i, 4);
406                             if (array_key_exists($name, $results)) {
407                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
408                                 $results[$name] = array(($r + $relevance) * 2,
409                                                         $t,$m,$d,$w,$u);
410                             } else {
411                                 $id = $name;
412                                 $m = strtolower($module);
413                                 $url = "html/libxml-$module.html#$id";
414                                 $results[$name] = array($relevance,$type,
415                                                 $module, $desc, $name, $url);
416                             }
417                         }
418                         mysql_free_result($result);
419                     }
420                 }
421                 if (($scope == 'any') || ($scope == 'XSLT') ||
422                     ($scope == 'API') || ($scope == 'XSLTAPI')) {
423                     list($result, $j) = XSLTqueryWord("xslt$word");
424                     if ($j > 0) {
425                         for ($i = 0; $i < $j; $i++) {
426                             $relevance = mysql_result($result, $i, 0);
427                             $name = mysql_result($result, $i, 1);
428                             $type = mysql_result($result, $i, 2);
429                             $module = mysql_result($result, $i, 3);
430                             $desc = mysql_result($result, $i, 4);
431                             if (array_key_exists($name, $results)) {
432                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
433                                 $results[$name] = array(($r + $relevance) * 2,
434                                                         $t,$m,$d,$w,$u);
435                             } else {
436                                 $id = $name;
437                                 $m = strtolower($module);
438                                 $url = "XSLT/html/libxslt-$module.html#$id";
439                                 $results[$name] = array($relevance,$type,
440                                                 $module, $desc, $name, $url);
441                             }
442                         }
443                         mysql_free_result($result);
444                     }
445                 }
446             }
447             mysql_close($link);
448             $nb = count($results);
449             echo "<h3 align='center'>Found $nb results for query $query</h3>\n";
450             usort($results, "resSort");
451
452             if ($nb > 0) {
453                 printf("<table><tbody>\n");
454                 printf("<tr><td>Quality</td><td>Symbol</td><td>Type</td><td>module</td><td>Description</td></tr>\n");
455                 $i = 0;
456                 while (list ($name, $val) = each ($results)) {
457                     list($r,$t,$m,$d,$s,$u) = $val;
458                     $m = str_replace("<", "&lt;", $m);
459                     $s = str_replace("<", "&lt;", $s);
460                     $d = str_replace("<", "&lt;", $d);
461                     echo "<tr><td>$r</td><td><a href='$u'>$s</a></td><td>$t</td><td>$m</td><td>$d</td></tr>";
462                     $i = $i + 1;
463                     if ($i > 75)
464                         break;
465                 }
466                 printf("</tbody></table>\n");
467             }
468         }
469     }
470 ?>
471
472 </td></tr></table></td></tr></table></td></tr></table></td>
473 </tr></table></td></tr></table>
474 </body>
475 </html>
476