I have a code that runs through an .ofx file for reading its markup. However, the .ofx code has a header that makes it impossible to read (that is, for the javascript code to work I have to remove the header manually). Is there any way to set the line to which javascript will start a function?
.ofx example:
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0</CODE>
<SEVERITY>INFO</SEVERITY>
</STATUS>
I wanted my code to ignore from OFXHEADER:100
to NEWFILEUID:NONE
and just started working from the <OFX>
tag.
I'm using this code to capture the tags I want:
function loadOFXDoc() {
var reader = new XMLHttpRequest();
reader.onreadystatechange = function() {
if (reader.readyState == 4 && reader.status == 200) {
showContent(reader);
}
};
reader.open("GET", "sample.ofx", true);
reader.send();
}
function showContent(xml) {
var i;
var ofxDoc = xml.responseXML;
var table="<tr><th>Local</th><th>Valor</th></tr>";
var x = ofxDoc.getElementsByTagName("STMTTRN");
for (i = 0; i <x.length; i++) {
table += "<tr><td>" +
x[i].getElementsByTagName("MEMO")[0].childNodes[0].nodeValue +
"</td><td>" +
x[i].getElementsByTagName("TRNAMT")[0].childNodes[0].nodeValue +
"</td></tr>";
}
document.getElementById("demo").innerHTML = table;
}
loadOFXDoc();