Simple high-level wrapper for Sarissa

In some cases, Sarissa calls are too low-level for my needs. For example, sometimes I need a function that would load an XML document synchronously and just throw an error if something fails. Here it is:
function loadURI(uri,async) {
var d = Sarissa.getDomDocument();
d.async = false;
d.load(uri);
if (d.parseError) throw("Error loading "+uri+": "+Sarissa.getParseErrorText(d));
return d;
}

1 comment:

Anonymous said...

Cool, thanks -- I'm always looking for quick helper functions. Sarissa is really cool, but at times the code gets a little complex. This helps.

Post a Comment