私は 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 にカンマがないことに気付きました。
編集:私の質問は、関数がいつ実行されるかです-明示的に呼び出すことができないためです