Display all atributes from XML Document

Hi everyone and thanks for reading my question!

I have the following XML document that has exactly this structure:

What I want to do is to display on Output panel the attributes (the text that is appearing) in tags item1 and item2.

So in my output panel in flash I want to display:


Actionscript 2 si XML
 Actionscript 2 tutorial si XML


How I can achieve that?

So as you can see I want to display all attributes from tag named titlu in my xml document named elementradacina.xml.

Here’s the code tried in my fla file:


// loads XML document in Flash with the name specified

// in this case loads elementradacina.xml document in Flash

// create object xmldocument from class XML


var xmldocument:XML = new XML()

// we set ignoreWhite property to true

xmldocument.ignoreWhite = true;

xmldocument.onLoad = function(succes:Boolean):Void
{// variable succes specifies if the document XML was loaded or not in Flash
if(succes)
// node root has a variable named xmlRoot that is object of class XMLNode

//node root name is <elementradacina>
 {var xmlRoot:XMLNode = this.firstChild; 
 
 // reference to item tags specify by variable xmlItem
  var xmlItem:XMLNode;
 
 for (var i:Number = 0; i<xmlRoot.childNodes.length;i++)
   {
       xmlItem = xmlRoot.childNodes*;
       trace(xml.attributes.title);

//trace(xml.attributes.titlu);
   }
 }
};
xmldocument.load("elementradacina.xml");