PDA

View Full Version : deleting the contents of an XMLList


theelephantwords
03-28-2008, 04:16 PM
hey. so i have an XMLList, and i want to delete its contents. how can i do this?

subXMLList = _data.section.(@name == mainS).children()[2].page.(@name == subS);

that holds the right value, but how can i keep the variable, but remove its value? these don't work:

subXMLList = null;
subXMLList = '';
delete subXMLList;

Jerion
03-28-2008, 04:25 PM
You mean, delete the whole xml item? Try this:

delete(subXMLList[0])

Remember that XMLList is an array of xml items.

theelephantwords
03-28-2008, 04:27 PM
sorry i'm an idiot, onSubNav = null; worked.

jerion, that will probably also work. thanks!

wvxvw
03-28-2008, 04:29 PM
var xml:XML = <xml>
<a/>
<b/>
<c/>
</xml>;
var xmll:XMLList = xml.children().(/[a|b]/.test(name()));
while(xmll.length()){
delete xmll[0];
}
trace(xml.toXMLString());