I recently needed to process htdig results before sending them back to the
user. The htdig template system wasn't flexible enough to do what I wanted
(SQL queries on results). I originally modified the header/footer/results
templates to generate quasi-XML output and wrapped that inside PHP but there
were limitations there as well. The quasi-XML output didn't quite give me
enough information.

So I've taken a stab at XML output for htdig. It's based on htsearch and
works as a CGI. The output conforms to a DTD: I have included this DTD in
the patch. Using this new CGI you can do something like this:

        $xml =
HttpRetrieve("http://localhost/cgi-bin/xmlsearch?$QUERY_STRING";);
        $results = ParseXML($xml);
        if (exists($results->error)) {
                echo "Error";
                } else if ($results->search["MATCHES"] == 0) {
                echo "No results";
        } else {
                ... output the results and navbars ...
        }

Would this xmlsearch CGI be useful as a contrib program to htdig? An XML-RPC
version of xmlsearch is another possibility and my preferred option: the CGI
is just a first stab. Either way, is there a standard HTDIG DTD and if not,
is the one I have included in the patch a possible starting point?
 

 <<htdig-3.1.5-xml.diff.gz>> 

htdig-3.1.5-xml.diff.gz

Reply via email to