From 7fb188190bbf7d06ec9f626979aedfda4ea9f7ac Mon Sep 17 00:00:00 2001 From: OutCast3k Date: Mon, 8 Dec 2014 12:59:04 +0000 Subject: [PATCH] added xml parser (for ie) for when importing unspent inputs via the api --- js/coin.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/coin.js b/js/coin.js index ffec3c0..5e70288 100644 --- a/js/coin.js +++ b/js/coin.js @@ -401,9 +401,19 @@ var total = 0; 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++){ - 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 n = u.getElementsByTagName("tx_output_n")[0].childNodes[0].nodeValue; value += u.getElementsByTagName("value")[0].childNodes[0].nodeValue*1;