Hi 
I think it is better to use XMLList.length(). IF you one child it will be 1.
Hope this helps.
Thanks
ilikeflex



----- Original Message ----
From: Sergey Kovalyov <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, July 14, 2008 1:50:26 AM
Subject: [flexcoders] Cast XMLList with 1 child to XML


Hi All!
 
Is it correct to cast XMLList with 1 child to XML like this:
 
var myXMLList : XMLList = sourceXML..item. (@id == 1); // It is guaranteed that 
only one node with name == item and attribute id == 1 exists in sourceXML.
var myXML : XML = XML(myXMLList) ;
 
Actually it works and it fails only when I change the sourceXML thus there are 
more then one node with name == item and attribute id == 1 in it. In this case 
exception is thrown. But I would like to know is it correct approach in general 
or not.
 
Sergey. 


      

Reply via email to