-1

我是 JavaScript 新手,对语法不太熟悉。

我想知道功能如何

{       
    /*
   Data is split into distributions and relations - so append them
    */
    //getURLParameters();
    /*** Read in and parse the Distributome.xml DB ***/
    var xmlhttp=createAjaxRequest();
    var xmlDoc, xmlDoc1;
    xmlhttp.open("GET","distributome-relations.xml",false);
    xmlhttp.send();
    xmlDoc = xmlhttp.responseXML;
    xmlhttp=createAjaxRequest();
    xmlhttp.open("GET","distributome-references.xml",false);
    xmlhttp.send();
    xmlDoc1 = xmlhttp.responseXML;
    var node = xmlDoc.importNode(xmlDoc1.getElementsByTagName("references").item(0), true);
    xmlDoc.getElementsByTagName("distributome").item(0).appendChild(node);
        try{ 
        DistributomeXML_Objects=xmlDoc.documentElement.childNodes; 
    }catch(error){ 
        DistributomeXML_Objects=xmlDoc.childNodes; 
    } 

    traverseXML(false, null, DistributomeXML_Objects, distributome.nodes, distributome.edges, distributome.references, distributomeNodes, referenceNodes);

    xmlhttp=createAjaxRequest();
    xmlhttp.open("GET","Distributome.xml.pref",false);
    xmlhttp.send();
    if (!xmlhttp.responseXML.documentElement && xmlhttp.responseStream)
        xmlhttp.responseXML.load(xmlhttp.responseStream);
    var ontologyOrder = xmlhttp.responseXML;    
    getOntologyOrderArray(ontologyOrder);
            //console.log("firstread: xmlDoc: " xmlDoc);
}

我正在尝试打印 xmlDoc 的内容,以便下次为变量赋值时可以检查内容,这样我就知道我正在创建一个有效的文档。

为澄清起见 - 我正在使用 ProtoVis 并希望在上传包含一些数据的 XML 文件后重绘节点。

我需要解决的第一个问题是创建一个有效的 xmlDoc,以便我可以显示更新的信息,因此我想查看 xmlDoc 内容,以便我可以将其与下一次使用上传的文件为 xmlDoc 分配值时进行比较。

谢谢你的时间!

编辑:我意识到 console.log 缺少逗号。

编辑:我的问题是函数何时执行 - 因为我无法明确调用它

4

1 回答 1

0

你的语法是错误的。您缺少 a+来连接字符串:

console.log("firstread: xmlDoc: " + xmlDoc);
于 2012-05-27T19:12:06.117 回答