A Tip on using XML Class methods on XMLList Objects.

For using the XML Class methods with an XMLList Object containing one or more XML Objects you have to iterate through the XMLList Collection and apply the XML Class methods to each XML Object in the Collection.

For example use the for each.. in statement to iterate through the XMLList Collection and access the individual XML Objects and apply the required XML Class methods to the individual XML Objects.

Example:

Suppose i have an XMLList Like below

<firstwife>

<name>Aish</name>

<age>35</age>

<dob>12/10/1974</dob>

</firstwife>

<secoundwife>

<name>Anu</name>

<age>25</age>

<dob>10/12/1984</dob>

</secoundwife>

then i would iterate this XMLList like below,

for each(var xml:XML in resultXMLList)

{

trace(“ ”+xml);//now apply XML Class methods to this XML Object.

}

[Here resultXMLList is my XMLList]

Observe the output now,it will print out the individual XML’s.Enjoy the post.

Leave a Reply