javascript - E4X - Retrieve element without retrieving its children -


given xml object, how retrieve root element without retrieving children?

e.g.:

var examplexml = new xml("<parent name="teste"><child/><child2/><child3/></parent>"); examplexml.getonlyrootelement(); //<parent name="teste"/> 

i've found solution - flex e4x filter out children - didn't much. there better one?

ps: i'm running javascript in windows app using spidermonkey.

thanks

you can set child reference empty xmllist.

 examplexml.setchildren(new xmllist('')); 

if want preserve original xml object, make deep copy first

 childfreexml = examplexml.copy().setchildren(new xmllist('')); 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -