// Creare document XML in Actionscript 2 (AS2)
var xmlDocument:XML = new XML();
// specificam numele nodului radacina
// cream un nou nod cu functia createElement a clasei XML
var xmlRoot:XMLNode = xmlDocument.createElement("elementradacina");
/* daca afisam variabila xmlDocument in fereastra de Output nu va
aparea nimic pana nu vom folosi metoda appendChild()
*/
xmlDocument.appendChild(xmlRoot);
trace(xmlDocument);
// cream un nou nod cu numele item1 stocat in variabila xmlItem
var xmlItem:XMLNode = xmlDocument.createElement("item1");
// adaugam un atribut cu titlul Actionscript la tag-uil item1
xmlItem.attributes.title="ActionScript";
// tag-ul title este nested in tag-ul item1
var xmlTitle:XMLNode = xmlDocument.createElement("title");
xmlItem.appendChild(xmlTitle);
// adaugam un text node in tag-ul title cu functia createTextNode
var xmlTitleText:XMLNode = xmlDocument.createTextNode("Actionscript");
xmlTitle.appendChild(xmlTitleText);
But it’s displaying only my root node elementradacina.
Here it is the result. Also I have a tag named item1 that contains a title and the tag title is nested in tag item1 and also tag title has an attribute called Actionscript.
What I’m doing wrong it only displays my root node named elementradacina. :zipper:
Here is the result: