HOW TO: Delete an XML node using E4X
While creating a sample application for some class content the other day, I ran into an XML/E4X situation that I’d never encountered before. It is pretty basic – deleting a node from XML. How does one do it? With the delete keyword of course!
For example:
[as]var myXML:XML =
- Hamburger
- Fries
- Med. Soda
- Lg. Soda
;
// Delete the Med. Soda node
// Output the XML
trace( myXML.toXMLString() );
// Result
//
// - Hamburger
// - Fries
// - Med. Soda
// - Lg. Soda
//
delete myXML.item[2];
// Output the edited XML
trace( myXML.toXMLString() );
// Result
//
// - Hamburger
// - Fries
// - Lg. Soda
//[/as]
Man, E4X is so simple!
|
download: Delete Node Example (4.78KB)
added: 04/09/2009
clicks: 441
description: Code source (.FLA) for delete XML node using E4X in ActionScript 3 sample
|
About John Crosby
A former professional foodie turned keyboard-jockey in favor of a keyboard, cushy chair and cooler working conditions. I now work at Realeyes Media. I am a Partner and Senior Developer and the office
Kuroko: In kabuki, the kuroko serve many of the same purposes as running crew. They move scenery and props on stage, aiding in scene changes and costume changes. They will also often play the role of animals, will-o-the-wisps, or other roles which are played not by an actor in full costume, but by holding a prop. Kuroko wear all black, head to toe, in order to imply that they are invisible and not part of the action onstage.
This entry was posted in
news and tagged
actionscript,
e4x,
xml. Bookmark the
permalink.
noo, really ?? -_-
Yeah really. The post might be helpful to someone – unlike your comment. -_-
Pingback: Recent Links Tagged With "e4x" - JabberTags