http://livedocs.adobe.com/labs/flex3/langref/XML.html#child()
http://livedocs.adobe.com/labs/flex3/langref/XML.html#descendants()


HTH,
Ben


--- In flexcoders@yahoogroups.com, "dan_of_philly"
<[EMAIL PROTECTED]> wrote:
>
> Hey,
> 
> I'm trying to get all the child nodes for an element in an XML tree
> given a node passed to a function as a string.
> 
> For example, given the xml:
> 
> <a>
> <first>
> <blah>...</blah>
> <foo>...</foo>
> <bar>...</bar>
> </first>
> <sec>
> <b2lah>...</b2lah>
> <f2oo>...</f2oo>
> <b2ar>...</b2ar>
> </sec>
> </a>
> 
> that is stored in say : var xml XMLList = "<a> ..."
> 
> and I have a function trying to return all the child nodes when given
> a certain element, how would I get the child nodes ? xml.. doesnt
> work if its a string.
> 
> public function getChildNodes( name:String):XMLList
> {
> var x:XMLList = xml..name ; // doesnt work ! Looks for 'name' node
> return x;
> }
> 
> Assuming name:String = "sec" , I would want the function to return:
> 
> "
> <b2lah>...</b2lah>
> <f2oo>...</f2oo>
> <b2ar>...</b2ar>
> "
> 
> Is the only answer to iterate through the entire tree ? That seems
> ridiculous ! I have a large xml tree, so I really dont want to
> iterate through it each time.
> 
> Any help is appreciated. Thanks
>


Reply via email to