So, it turns out that I had the Canadian holidays xml file in the searches
directory. As it was loading the searches, it would get to that file, and
die with no message.
I suspect its because it's well formed XML, just not valid - ie. it doesn't
have the correct fields. I suspect that this would be solved by checking
against a dtd/schema (does such a beast formally exist?) I've just thrown a
try-catch around the whole thing.
The problem was that as soon as that search failed, it dropped out of
loadSearchFile() and hence most of my searches weren't loaded (all those
falling alphabetically after holidays.ca.xml)
I've always been told I should be a software tester for a living - I manage
to break things in unusual/unforseen ways :)
Find my fixed loadSearchFile() function here (hopefully the email system
doesn't kill the formatting too badly):
function loadSearchFile( path )
{
var xml = readFile(path);
//alert (path + xml);
if (!xmldoc.loadXML(xml))
{
alert('Unable to load search from ' + path + ': ' +
xmldoc.parseError.reason );
return;
}
else
{
try
{
var searchNode = xmldoc.selectSingleNode("/search");
var funcname = searchNode.attributes.getNamedItem("function").text;
if (alertmode &&
searchRoot.selectSingleNode("/searches/search[@function='" + funcname +
"']")) {
qualifiedalert('Search "' + funcname + '" found in ' + path + '
already exists.');
return;
}
else if (alertmode && searchNode.selectSingleNode("/search" + "/FORM"))
{
alert('Search "' + funcname + '" has a <FORM> element which probably
needs to be lowercased (<form>)');
}
else
{
searchRoot.appendChild(searchNode);
}
}
catch (e)
{
alert('Unable to load search from ' + path + ': it appears to be well
formed XML, just not a valid search document');
}
}
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel