Imported Upstream version 2.9.4
[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     $querystr = htmlspecialchars($query, ENT_QUOTES, 'UTF-8');
106
107 ?>
108 <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:
109 <p>
110 <form action="<?php echo "$PHP_SELF", "?query=", rawurlencode($query) ?>"
111       enctype="application/x-www-form-urlencoded" method="GET">
112   <input name="query" type="TEXT" size="50" value="<?php echo $querystr?>">
113   <select name="scope">
114     <option value="any">Search All</option>
115     <option value="XML" <?php if ($scope == 'XML') print "selected"?>>XML resources</option>
116     <option value="XSLT" <?php if ($scope == 'XSLT') print "selected"?>>XSLT resources</option>
117     <option value="API" <?php if ($scope == 'API') print "selected"?>>Only the APIs</option>
118     <option value="XMLAPI" <?php if ($scope == 'XMLAPI') print "selected"?>>Only the XML API</option>
119     <option value="XSLTAPI" <?php if ($scope == 'XSLTAPI') print "selected"?>>Only the XSLT API</option>
120     <option value="DOCS" <?php if ($scope == 'DOCS') print "selected"?>>Only the Documentation</option>
121     <option value="XMLDOC" <?php if ($scope == 'XMLDOC') print "selected"?>>Only the XML Documentation</option>
122     <option value="XSLTDOC" <?php if ($scope == 'XSLTDOC') print "selected"?>>Only the XSLT Documentation</option>
123     <option value="LISTS" <?php if ($scope == 'LISTS') print "selected"?>>Only the lists archives</option>
124     <option value="XMLLIST" <?php if ($scope == 'XMLLIST') print "selected"?>>Only the XML list archive</option>
125     <option value="XSLTLIST" <?php if ($scope == 'XSLTLIST') print "selected"?>>Only the XSLT list archive</option>
126   </select>
127   <input name=submit type=submit value="Search ...">
128 </form>
129 <?php
130     function logQueryWord($word) {
131         $result = mysql_query ("SELECT ID,Count FROM Queries WHERE Value='$word'");
132         if ($result) {
133             $i = mysql_num_rows($result);
134             if ($i == 0) {
135                 mysql_free_result($result);
136                 mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
137             } else {
138                 $id = mysql_result($result, 0, 0);
139                 $count = mysql_result($result, 0, 1);
140                 $count ++;
141                 mysql_query ("UPDATE Queries SET Count=$count WHERE ID=$id");
142             }
143         } else {
144             mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
145         }
146     }
147     function queryWord($word) {
148         $result = NULL;
149         $j = 0;
150         if ($word) {
151             $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");
152             if ($result) {
153                 $j = mysql_num_rows($result);
154                 if ($j == 0) 
155                     mysql_free_result($result);
156             }
157             logQueryWord($word);
158         }
159         return array($result, $j);
160     }
161     function queryHTMLWord($word) {
162         $result = NULL;
163         $j = 0;
164         if ($word) {
165             $result = mysql_query ("SELECT relevance, name, id, resource, section FROM wordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
166             if ($result) {
167                 $j = mysql_num_rows($result);
168                 if ($j == 0) 
169                     mysql_free_result($result);
170             }
171             logQueryWord($word);
172         }
173         return array($result, $j);
174     }
175     function queryArchiveWord($word) {
176         $result = NULL;
177         $j = 0;
178         if ($word) {
179             $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");
180             if ($result) {
181                 $j = mysql_num_rows($result);
182                 if ($j == 0) 
183                     mysql_free_result($result);
184             }
185             logQueryWord($word);
186         }
187         return array($result, $j);
188     }
189     function XSLTqueryWord($word) {
190         $result = NULL;
191         $j = 0;
192         if ($word) {
193             $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");
194             if ($result) {
195                 $j = mysql_num_rows($result);
196                 if ($j == 0) 
197                     mysql_free_result($result);
198             }
199             logQueryWord($word);
200         }
201         return array($result, $j);
202     }
203     function XSLTqueryHTMLWord($word) {
204         $result = NULL;
205         $j = 0;
206         if ($word) {
207             $result = mysql_query ("SELECT relevance, name, id, resource, section FROM XSLTwordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
208             if ($result) {
209                 $j = mysql_num_rows($result);
210                 if ($j == 0) 
211                     mysql_free_result($result);
212             }
213             logQueryWord($word);
214         }
215         return array($result, $j);
216     }
217     function XSLTqueryArchiveWord($word) {
218         $result = NULL;
219         $j = 0;
220         if ($word) {
221             $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");
222             if ($result) {
223                 $j = mysql_num_rows($result);
224                 if ($j == 0) 
225                     mysql_free_result($result);
226             }
227             logQueryWord($word);
228         }
229         return array($result, $j);
230     }
231     function resSort ($a, $b) {
232         list($ra,$ta,$ma,$na,$da) = $a;
233         list($rb,$tb,$mb,$nb,$db) = $b;
234         if ($ra == $rb) return 0;
235         return ($ra > $rb) ? -1 : 1;
236     }
237     if (($query) && (strlen($query) <= 50)) {
238         $link = mysql_connect ("localhost", "nobody");
239         if (!$link) {
240             echo "<p> Could not connect to the database: ", mysql_error();
241         } else {
242             mysql_select_db("xmlsoft", $link);
243             $list = explode (" ", $query);
244             $results = array();
245             $number = 0;
246             for ($number = 0;$number < count($list);$number++) {
247
248                 $word = $list[$number];
249                 if (($scope == 'any') || ($scope == 'XML') ||
250                     ($scope == 'API') || ($scope == 'XMLAPI')) {
251                     list($result, $j) = queryWord($word);
252                     if ($j > 0) {
253                         for ($i = 0; $i < $j; $i++) {
254                             $relevance = mysql_result($result, $i, 0);
255                             $name = mysql_result($result, $i, 1);
256                             $type = mysql_result($result, $i, 2);
257                             $module = mysql_result($result, $i, 3);
258                             $desc = mysql_result($result, $i, 4);
259                             if (array_key_exists($name, $results)) {
260                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
261                                 $results[$name] = array(($r + $relevance) * 2,
262                                                         $t,$m,$d,$w,$u);
263                             } else {
264                                 $id = $name;
265                                 $m = strtolower($module);
266                                 $url = "html/libxml-$module.html#$id";
267                                 $results[$name] = array($relevance,$type,
268                                                 $module, $desc, $name, $url);
269                             }
270                         }
271                         mysql_free_result($result);
272                     }
273                 }
274                 if (($scope == 'any') || ($scope == 'XSLT') ||
275                     ($scope == 'API') || ($scope == 'XSLTAPI')) {
276                     list($result, $j) = XSLTqueryWord($word);
277                     if ($j > 0) {
278                         for ($i = 0; $i < $j; $i++) {
279                             $relevance = mysql_result($result, $i, 0);
280                             $name = mysql_result($result, $i, 1);
281                             $type = mysql_result($result, $i, 2);
282                             $module = mysql_result($result, $i, 3);
283                             $desc = mysql_result($result, $i, 4);
284                             if (array_key_exists($name, $results)) {
285                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
286                                 $results[$name] = array(($r + $relevance) * 2,
287                                                         $t,$m,$d,$w,$u);
288                             } else {
289                                 $id = $name;
290                                 $m = strtolower($module);
291                                 $url = "XSLT/html/libxslt-$module.html#$id";
292                                 $results[$name] = array($relevance,$type,
293                                                 $module, $desc, $name, $url);
294                             }
295                         }
296                         mysql_free_result($result);
297                     }
298                 }
299                 if (($scope == 'any') || ($scope == 'XML') ||
300                     ($scope == 'DOCS') || ($scope == 'XMLDOC')) {
301                     list($result, $k) = queryHTMLWord($word);
302                     if ($k > 0) {
303                         for ($i = 0; $i < $k; $i++) {
304                             $relevance = mysql_result($result, $i, 0);
305                             $name = mysql_result($result, $i, 1);
306                             $id = mysql_result($result, $i, 2);
307                             $module = mysql_result($result, $i, 3);
308                             $desc = mysql_result($result, $i, 4);
309                             if (strncmp($module, "libxml-", 7) == 0)
310                                 $url = "html/$module";
311                             if ($id != "") {
312                                 $url = $url + "#$id";
313                             }
314                             $results["$name _html_ $number _ $i"] =
315                                           array($relevance, "XML docs",
316                                                 $module, $desc, $name, $url);
317                         }
318                         mysql_free_result($result);
319                     }
320                 }
321                 if (($scope == 'any') || ($scope == 'XSLT') ||
322                     ($scope == 'DOCS') || ($scope == 'XSLTDOC')) {
323                     list($result, $k) = XSLTqueryHTMLWord($word);
324                     if ($k > 0) {
325                         for ($i = 0; $i < $k; $i++) {
326                             $relevance = mysql_result($result, $i, 0);
327                             $name = mysql_result($result, $i, 1);
328                             $id = mysql_result($result, $i, 2);
329                             $module = mysql_result($result, $i, 3);
330                             $desc = mysql_result($result, $i, 4);
331                             $url = "XSLT/$module";
332                             if ($id != "") {
333                                 $url = $url + "#$id";
334                             }
335                             $results["$name xslthtml $number _ $i "] =
336                                           array($relevance, "XSLT docs",
337                                                 $module, $desc, $name, $url);
338                         }
339                         mysql_free_result($result);
340                     }
341                 }
342                 if (($scope == 'any') || ($scope == 'XML') ||
343                     ($scope == 'LISTS') || ($scope == 'XMLLIST')) {
344                     list($result, $j) = queryArchiveWord($word);
345                     if ($j > 0) {
346                         for ($i = 0; $i < $j; $i++) {
347                             $relevance = mysql_result($result, $i, 0);
348                             $name = mysql_result($result, $i, 1);
349                             $type = mysql_result($result, $i, 2);
350                             $url = mysql_result($result, $i, 3);
351                             $desc = mysql_result($result, $i, 4);
352                             if (array_key_exists($url, $results)) {
353                                 list($r,$t,$m,$d,$w,$u) = $results[$url];
354                                 $results[$name] = array(($r + $relevance) * 2,
355                                                         $t,$m,$d,$w,$u);
356                             } else {
357                                 $id = $name;
358                                 $m = strtolower($module);
359                                 $u = str_replace(
360                         "http://mail.gnome.org/archives/xml/", "", $url);
361                                 $results[$url] = array($relevance,$type,
362                                                 $u, $desc, $name, $url);
363                             }
364                         }
365                         mysql_free_result($result);
366                     }
367                 }
368                 if (($scope == 'any') || ($scope == 'XSLT') ||
369                     ($scope == 'LISTS') || ($scope == 'XSLTLIST')) {
370                     list($result, $j) = XSLTqueryArchiveWord($word);
371                     if ($j > 0) {
372                         for ($i = 0; $i < $j; $i++) {
373                             $relevance = mysql_result($result, $i, 0);
374                             $name = mysql_result($result, $i, 1);
375                             $type = mysql_result($result, $i, 2);
376                             $url = mysql_result($result, $i, 3);
377                             $desc = mysql_result($result, $i, 4);
378                             if (array_key_exists($url, $results)) {
379                                 list($r,$t,$m,$d,$w,$u) = $results[$url];
380                                 $results[$name] = array(($r + $relevance) * 2,
381                                                         $t,$m,$d,$w,$u);
382                             } else {
383                                 $id = $name;
384                                 $m = strtolower($module);
385                                 $u = str_replace(
386                         "http://mail.gnome.org/archives/xslt/", "", $url);
387                                 $results[$url] = array($relevance,$type,
388                                                 $u, $desc, $name, $url);
389                             }
390                         }
391                         mysql_free_result($result);
392                     }
393                 }
394             }
395             if ((count($results) == 0) && (count($list) == 1)) {
396                 $word = $list[0];
397                 if (($scope == 'any') || ($scope == 'XML') ||
398                     ($scope == 'API') || ($scope == 'XMLAPI')) {
399                     list($result, $j) = queryWord("xml$word");
400                     if ($j > 0) {
401                         for ($i = 0; $i < $j; $i++) {
402                             $relevance = mysql_result($result, $i, 0);
403                             $name = mysql_result($result, $i, 1);
404                             $type = mysql_result($result, $i, 2);
405                             $module = mysql_result($result, $i, 3);
406                             $desc = mysql_result($result, $i, 4);
407                             if (array_key_exists($name, $results)) {
408                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
409                                 $results[$name] = array(($r + $relevance) * 2,
410                                                         $t,$m,$d,$w,$u);
411                             } else {
412                                 $id = $name;
413                                 $m = strtolower($module);
414                                 $url = "html/libxml-$module.html#$id";
415                                 $results[$name] = array($relevance,$type,
416                                                 $module, $desc, $name, $url);
417                             }
418                         }
419                         mysql_free_result($result);
420                     }
421                 }
422                 if (($scope == 'any') || ($scope == 'XSLT') ||
423                     ($scope == 'API') || ($scope == 'XSLTAPI')) {
424                     list($result, $j) = XSLTqueryWord("xslt$word");
425                     if ($j > 0) {
426                         for ($i = 0; $i < $j; $i++) {
427                             $relevance = mysql_result($result, $i, 0);
428                             $name = mysql_result($result, $i, 1);
429                             $type = mysql_result($result, $i, 2);
430                             $module = mysql_result($result, $i, 3);
431                             $desc = mysql_result($result, $i, 4);
432                             if (array_key_exists($name, $results)) {
433                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
434                                 $results[$name] = array(($r + $relevance) * 2,
435                                                         $t,$m,$d,$w,$u);
436                             } else {
437                                 $id = $name;
438                                 $m = strtolower($module);
439                                 $url = "XSLT/html/libxslt-$module.html#$id";
440                                 $results[$name] = array($relevance,$type,
441                                                 $module, $desc, $name, $url);
442                             }
443                         }
444                         mysql_free_result($result);
445                     }
446                 }
447             }
448             mysql_close($link);
449             $nb = count($results);
450             echo "<h3 align='center'>Found $nb results for query $querystr</h3>\n";
451             usort($results, "resSort");
452
453             if ($nb > 0) {
454                 printf("<table><tbody>\n");
455                 printf("<tr><td>Quality</td><td>Symbol</td><td>Type</td><td>module</td><td>Description</td></tr>\n");
456                 $i = 0;
457                 while (list ($name, $val) = each ($results)) {
458                     list($r,$t,$m,$d,$s,$u) = $val;
459                     $m = str_replace("<", "&lt;", $m);
460                     $s = str_replace("<", "&lt;", $s);
461                     $d = str_replace("<", "&lt;", $d);
462                     echo "<tr><td>$r</td><td><a href='$u'>$s</a></td><td>$t</td><td>$m</td><td>$d</td></tr>";
463                     $i = $i + 1;
464                     if ($i > 75)
465                         break;
466                 }
467                 printf("</tbody></table>\n");
468             }
469         }
470     }
471 ?>
472
473 </td></tr></table></td></tr></table></td></tr></table></td>
474 </tr></table></td></tr></table>
475 </body>
476 </html>
477