I am reading a XML file through SpineTix which is built on Javascript. I've created a custom parser for this.
This is the XML structure
<ArlandaExpress>
<info>
<updated date="2013-06-10" time="10:28:42"/>
<message priority="1">
<![CDATA[
Biljettköp ombord kostar 100:- extra, ticket on board 100 SEK extra
]]>
</message>
<message priority="2">
<![CDATA[
Biljettköp ombord kostar 100:- extra, ticket on board 100 SEK extra
]]>
</message>
<message priority="3">
<![CDATA[
Restid 20 min. 2 för 380 kr tor-sön och röda dagar t.o.m.16/6// Traveltime 20 min. 2 for 380 SEK Thu-Sun and bank holidays until 16/6
]]>
</message>
</info>
<StockholmC>
<next minutes="6"/>
<upcoming datetime="2013-06-10 10:50"/>
<upcoming datetime="2013-06-10 11:05"/>
<upcoming datetime="2013-06-10 11:20"/>
</StockholmC>
</ArlandaExpress>
I need to grab the minutes and datetime attributes in the StockholmC tag. How can I do this? This is my code so far which by the way works if you remove all other tags from the document but StockholmC
function custom_parser( response, records ){
var rssDocument = parseXML( response );
if ( rssDocument==null ) return;
for ( var row=rssDocument.documentElement.firstElementChild; row!=null; row=row.nextElementSibling ) {
var r = new Object();
r.next = row.getAttribute('minutes');
r.date = row.getAttribute('datetime');
records.push( r );
}
}
I want to point out that the above code works in a XML file with ONLY the StockholmC tag.
Thank you