Hi

I was wondering if anyone would be able to help with this. I posted to the Actionscript section originally as I didn't see this XML forum. We've got a content management system that produces the following XML file (data.xml) and whilst I've had no problem reading this file using ASP in the past, i'm finding it almost impossible with Flash. We're using Flash 8 Pro and upgrading the front end of the content management system to use Flash. I can extract the <frontpage> and the <images> data without too much problem, but the nested <item> in the <news> element is proving near impossible. I am using .nodeValue which appears to return "null" yet .nodeName returns the correctly name of the node. I have included the code I'm using below the XML example.

<?xml version="1.0" encoding="utf-8"?>

<website>
<!-- there is only one FRONTPAGE element -->
<frontpage>
<heading>Kit Roxburgh - Recording Artist</heading>
<headingsmall><![CDATA[<span class='head'>brief data here</span>]]></headingsmall>
<maintext><![CDATA[<img src='images/s4.jpg' align='right' /><span class='p'>main text here...</span><br/><br/>]]></maintext>
</frontpage>

<news>
<!-- there can be one or multiple ITEM elements below -->
<item date="20.08.2006" image="images/s1.jpg">
<heading>Heading Here</heading>
<shortdesc><![CDATA[<p class='p'>HTML Text Here</p>]]></shortdesc>
<maintext><![CDATA[More Data Here]]></maintext>
</item>
<item date="19.08.2006" image="images/s1.jpg">
<heading>Heading Here</heading>
<shortdesc><![CDATA[<p class='p'>HTML Text Here</p>]]></shortdesc>
<maintext><![CDATA[More Data Here]]></maintext>
</item>
</news>

<images>
<!-- there should only ever be 6 items below... -->
<image thumb="images/s1.jpg" file="images/b1.jpg" desc=""/>
<image thumb="images/s2.jpg" file="images/b2.jpg" desc=""/>
<image thumb="images/s3.jpg" file="images/b3.jpg" desc=""/>
<image thumb="images/s4.jpg" file="images/b4.jpg" desc=""/>
<image thumb="images/s5.jpg" file="images/b5.jpg" desc=""/>
<image thumb="images/s6.jpg" file="images/b6.jpg" desc=""/>
</images>
</website>




// CREATE AN INSTANCE OF THE XML OBJECT FOR USE THROUGHOUT THE DOCUMENT.
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {

trace("loaded the data.xml file");

var newsNodes:XMLNode = this.firstChild.childNodes[1]; // first child of FRONTPAGE... heading

var i:Number = 0;
for (var XMLstring:XMLNode = newsNodes.firstChild; XMLstring != null; XMLstring = XMLstring.nextSibling, i++) {
trace("Date: " + newsItems.attributes.date);
trace("Image: " + newsItems.attributes.image);
var j:Number = 0;
for (var itemString:XMLNode = XMLstring.firstChild; itemString != null; itemString = itemString.nextSibling, j++) {
// should return the following:
// heading
// shortdesc
// maintext
trace("itemString Name: " + itemString.nodeName); // works correctly, returns the node name value correctly
trace("itemString Value: " + itemString.nodeValue); // seems to always return "null" ???
}
}
} else {
// unable to read the xml
trace("unable to load XML document");
}
};
myXML.load("data.xml");


Thanks for any help, I'm lost as to why this doesn't work and it seems that Flash 8 doesn't support XPath from what I can tell, so I can't select the elements by name.. :-(

Thanks again!