microsoft XML DOMDocument and javascript error

I’m encountering a weird error where an embedded copy of IE is failing to load XML properly. Here’s the best approximation I have of what we’re doing:

function newDom()
{
    var dom = ActiveXObject("Msxml2.DOMDocument.4.0")
    dom.async = false;
    dom.validateOnParse = false;
    dom.resolveExternals = false;
    dom.setProperty("SelectionLanguage", "XPath");
    return dom;
}
function loadXML(url)
{
    var dom = newDom();
    var ret = dom.load(url);
    if (ret == false)
    {
        pe = dom.parseError;
        // reason has a CRLF at the end
        alert("Error 0x" + formatHex(pe.errorCode) + ": " + pe.reason + url);
    }
    return dom;
}
function transform(xmlurl, xslurl)
{
    return loadXML(xmlurl).transformNode(loadXML(xslurl));
}
function writeHTML(obj, str)
{
    obj.write("");
    obj.close();
    obj.write(str);
    obj.close();
}
var html = transform(".../foo.xml", ".../foo.xsl");
write(document.fooDiv, html);

This code runs inside an application that has embedded IE. The doc itself is being loaded from a local webserver running on the same machine. The problem comes in on dom.load(url)… For some reason, usually on .xsl files, that line blocks for 5 minutes, and the error code is 0x800C000B. Google says that’s urlmon.dll’s “operation timed out” error… which makes sense, to a point. But the request never hits the local webserver (which for various reasons is actually running as a proxy, but enough about that).

Any ideas, suggestions, hmm?

This entry was posted in tech. Bookmark the permalink.

2 Responses to microsoft XML DOMDocument and javascript error

  1. Pingback: ((meatspace)) » Blog Archive » PHP Debugging Tip

  2. dbt says:

    And what’s the solution? If you don’t return the XML gzipped, the problem goes away. Classic.

Leave a Reply to dbt Cancel reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>