added xml parser (for ie) for when importing unspent inputs via the api

This commit is contained in:
OutCast3k 2014-12-08 12:59:04 +00:00
parent 73530d55db
commit 7fb188190b

View file

@ -401,9 +401,19 @@
var total = 0; var total = 0;
var x = {}; var x = {};
var unspent = data.getElementsByTagName("unspent")[0]; if (window.DOMParser) {
parser=new DOMParser();
xmlDoc=parser.parseFromString(data,"text/xml");
} else {
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(data);
}
var unspent = xmlDoc.getElementsByTagName("unspent")[0];
for(i=1;i<=unspent.childElementCount;i++){ for(i=1;i<=unspent.childElementCount;i++){
var u = data.getElementsByTagName("unspent_"+i)[0] var u = xmlDoc.getElementsByTagName("unspent_"+i)[0]
var txhash = u.getElementsByTagName("tx_hash")[0].childNodes[0].nodeValue; var txhash = u.getElementsByTagName("tx_hash")[0].childNodes[0].nodeValue;
var n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue; var n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue;
value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1; value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1;