[haXe] Xml parsing: finding a node?
Ralf Bokelberg
ralf.bokelberg at gmail.com
Fri Aug 18 12:14:52 CEST 2006
Yep,
that should do the trick,
thanks,
Ralf
On 8/18/06, Nicolas Cannasse <ncannasse at motion-twin.com> wrote:
> > Hi Nicolas,
> >
> > how can i find a node in xml, if i don't know where it is?
> >
> > In AS2 i use the childNodes & parentNode pointer to implement a
> > nonrecursive depth first search. I wonder how to do that in haxe?
> >
> > Cheers
> > Ralf.
>
> Just one quick try, not tested or even compiled :
>
> function searchNode( root : Xml, name : String ) : Xml {
> var stack = new List();
> stack.push(root.elements());
> while( !stack.isEmpty() ) {
> for( x in stack.pop() ) {
> if( x.nodeName == name )
> return x;
> stack.push(x.elements());
> }
> }
> return null;
> }
>
> Nicolas
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
--
Ralf Bokelberg <ralf.bokelberg at gmail.com>
Flex & Flash Consultant based in Cologne/Germany
More information about the Haxe
mailing list