I havé an XML-file with this structure.
[size=2][color=#0000ff]
[/color][/size]
<?xmlversion="1.0"encoding="utf-8"?>
<links name="Länkar">
<subject name="Skolan">
<link nr="1">
<linkname name="HIK"/>
<link href="http://www.hik.se"/>
</link>
<link nr="2">
<linkname name="Webbprogrammering"/>
<link href="https://www.te.hik.se/tekinet/kurser/dtt/wp/"/>
</link>
<linknr="3">
<linkname name="Actionscript"/>
<link href="http://www.te.hik.se/tekinet/kurser/dtt/wp_action/index.php?sida=start"/>
</link>
</subject>
[size=2][color=#0000ff]how do I do to read out the data from this file? I have managed to find out how to read the first and second level. I think I need a new for-loop to get all data inside the “link-tag”, but Im not sure. My code looks like this.[/color][/size]
System.useCodepage = true;
var xmlTreeData:XML = new XML();
xmlTreeData.load("links.xml");
xmlTreeData.ignoreWhite = true;
xmlTreeData.onLoad = function(bSuccess:Boolean):Void {
if(bSuccess) {
var xmlnRoot:XMLNode = xmlTreeData.firstChild;
var aNodes:Array = xmlnRoot.childNodes;
trace(this.firstChild.attributes.name)
for(var i:Number = 0; i < aNodes.length; i++) {
trace(this.firstChild.childNodes*.attributes.name);
}
}
else {
trace("Filen gick inte att ladda.");
}
};
[size=2][color=#0000ff]I hope somebody can help me…
[/color][/size]