Well, if you need exact output you could use this line:
this approach much faster than doing xmlfiltering + redundant garbage deletion, hope this helps
Interesting idea. Let me pose my actual scenario and see if you think this is still the right approach, or if maybe there's a better way.
I want to feed this XMLList as a dataprovider to a Tree UI component, and I don't want the tree to render the <garbage/> tags, I just want one level rendered for now (I'll update the tree data manually and add child nodes to the XML datasource programatically as the tree is traversed by the user).
The full potential scope of the tree is huge, so I only want to render it as the user drills into particular sections.
The XML I get just has some extra useless child tags in it (the <garbage/> tags in the example).
Thanks again for the much appreciated help and advice!!
Never mind, I worked out a better, or at least good method of doing this - My assumption that there were many objects wasn't correct. I built 2 data structures, one for the UI components (a pretty small set) for the Tree, and one for all the properties of only the component I was displaying at that particular moment (I was previously trying to fit everything into one data structure, presumably for simplicity, but getting quite the opposite result).
Thanks again for the pointers! Very helpful!