The inlined-file cr.xml searches the online version of Consumer Reports, including paper-version back issues, forums, web ratings, recalls, and consumer alerts.
I had to learn how to create dynamic form elements for this one. ConsumerReports.org uses form element names that violate some rule in DQSD; i.e., you can't have form elements that have '<' or '>' in the name. Unfortunately, one of those two form elements is the actual search term box. I used DOM function calls to create the form elements dynamically and to add them as child nodes to the form. If the inline comments don't make it plain, let me know, and I'll try to explain what's going on more clearly. Regards, Gregory Krohne -------------------------------------- Protect yourself from spam, use http://sneakemail.com -- cut here cr.xml -- <search function="cr"> <comment> Search the online version of Consumer Reports. Registration required for some content. </comment> <name>Consumer Reports</name> <category>Shopping</category> <contributor>Gregory Krohne</contributor> <link>http://www.consumerreports.org/</link> <email>[EMAIL PROTECTED]</email> <description> Search for unbiased advice and ratings about products and services, personal finance, health and nutrition, and other consumer concerns. Registration required for some content. <div class="helpboxDescLabels">Examples:</div> <table class="helpboxDescTable"> <tr><td>cr Acura NSX</td></tr> <tr><td>cr vacuum cleaners</td></tr> </table> </description> <form name="crf" method="post" action="http://www.consumerreports.org/main/home.jsp"> <input type="hidden" name="bmForm" value="cr_header_search_form" /> <input type="hidden" name="bmFormID" value="" /> <input type="hidden" name="bmUID" value="" /> <input type="hidden" name="bmIsForm" value="true" /> <input type="hidden" name="bmPrevTemplate" value="main/home.jsp" /> <input type="hidden" name="bmHidden" value="SUCCESS<>headerSearchForm" /> <input type="hidden" name="bmHidden" value="cu_category_lev1" /> <input type="hidden" name="cu_category_lev1" value="0" /> <input type="hidden" name="bmText" value="SEARCH_INPUT<>searchFor" /> <input type="hidden" name="bmImage" value="cr_header_search_form.x" /> <input type="hidden" name="bmImage" value="cr_header_search_form.y" /> </form> <script><![CDATA[ function cr(q) { if( nullArgs("cr", q) ) return; // bmFormID and bmUID are 13 digits. I Hope this dosen't accidentally // step on someone else's session. var ID = Math.round(Math.random()*Math.pow(10, 13)); document.crf.bmFormID.value = ID; document.crf.bmUID.value = ID; // DQSD chokes on form elements that have '<' or '>' in the name, so we // have to create these elements dynamagically. This are the tags we want: // <input type="hidden" name="SEARCH_INPUT<>searchFor" value=q> // <input type="hidden" name="SEARCH_INPUT<>headerSearchForm" value=""> // Create the SEARCH_INPUT<>searchFor tag var searchFor = document.createElement('<input type="hidden" name="SEARCH_INPUT<>searchFor">'); searchFor.setAttribute('value', q); // Somehow, the old form elements stuck around on rapid, repetitive queries. // The web site would choke on multiple copies of these tags. // So, at this point we check to see if the tag already exists // If it exists, we replace it with a new copy. // If it doesn't exist, we insert a new tag at the end of the <form> var oldElement = document.getElementById("SEARCH_INPUT<>searchFor"); if (oldElement) document.crf.replaceChild(searchFor, oldElement); else document.crf.insertBefore(searchFor, document.crf.lastChild); // Create the SEARCH_INPUT<>headerSearchForm tag var headerSearchForm = document.createElement('<input type="hidden" name="SEARCH_INPUT<>headerSearchForm" value="">'); // Replace existing tag or insert new tag. oldElement = document.getElementById("SEARCH_INPUT<>headerSearchForm"); if (oldElement) document.crf.replaceChild(headerSearchForm, oldElement); else document.crf.insertBefore(headerSearchForm, document.crf.lastChild); submitForm(crf); } ]]></script> <copyright> The following applies if this file is included and distributed with Dave's Quick Search Deskbar: Copyright (c) 2002 David Bau; Distributed under the terms of the GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt) </copyright> <created_by> This search file was initially created on 04/20/04 at 16:32:55 by Dave's Quick Search Deskbar Search Wizard version 1.2, Copyright (c) 2002 Glenn Carr; Distributed under the terms of the GNU General Public License, Version 2 </created_by> </search> ------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ To unsubscribe visit: https://lists.sourceforge.net/lists/listinfo/dqsd-users [EMAIL PROTECTED] http://sourceforge.net/mailarchive/forum.php?forum_id=8601