Hi,
I’ve successfully loaded my xml and created three arrays to hold the news article date, title and text, using the following code:
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success) {
if (success) {
publishNews(my_xml);
}
};
function publishNews(xml_doc) {
var newsdate = new Array();
var newstitle = new Array();
var newstext = new Array();
for (var n = 0; n<xml_doc.firstChild.childNodes.length; n++) {
newstext.push(xml_doc.firstChild.childNodes[n].firstChild.firstChild);
newstitle.push(xml_doc.firstChild.childNodes[n].firstChild.nextSibling.firstChild);
newsdate.push(xml_doc.firstChild.childNodes[n].firstChild.nextSibling.nextSibling.firstChild);
}
}
my_xml.load("http://url....GetNewsData");
stop();
Here is my xml:
<NewDataSet>
<Table>
<pg_data>Lorem ipsum dolor sit amet</pg_data>
<pg_title>test title 1</pg_title>
<pg_timestamp>2005-10-20T00:00:00.0000000+01:00</pg_timestamp>
</Table>
<Table>
<pg_data>this is another news article</pg_data>
<pg_title>test title 2</pg_title>
<pg_timestamp>2005-10-21T00:00:00.0000000+01:00</pg_timestamp>
</Table>
</NewDataSet>
How do I firstly get my arrays into a textfield with the format date,<br> title,<br> story, and secondly how do I deal with that horrible datestamp to make a recognisable uk date?
Thanks in advance
P.