[flexcoders] Handling XML

2010-08-17 Thread Stephen
var xml:XML = 
library
shelf
book
chapterOnce Upon A Time/chapter
/book
/shelf
/library
;

var path1:XMLList = xml.shelf.book.chapter;
trace(path1:  + path1.text()); // output: path1: Once Upon A Time

var string:String = xml.shelf.book.chapter;
var path2:XMLList = XMLList(xml.shelf.book.chapter);
trace(path2:  + path2.text()); // output: path1:

Why do I get no output with the second trace, it looks like
the XMLList() dosn't work, any tips would be great.

- Criptopus



Re: [flexcoders] Handling XML

2010-08-17 Thread Alex Harui

There is no “eval” in actionscript.  To pass XMLLIst a string it would have to 
be a string that can be converted to XML, not something that references 
variables.

On 8/17/10 1:40 PM, Stephen sd_br...@ntlworld.com wrote:






var xml:XML =
library
shelf
book
chapterOnce Upon A Time/chapter
/book
/shelf
/library
;

var path1:XMLList = xml.shelf.book.chapter;
trace(path1:  + path1.text()); // output: path1: Once Upon A Time

var string:String = xml.shelf.book.chapter;
var path2:XMLList = XMLList(xml.shelf.book.chapter);
trace(path2:  + path2.text()); // output: path1:

Why do I get no output with the second trace, it looks like
the XMLList() dosn't work, any tips would be great.

- Criptopus






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui