If you have to perform basically the same operation at each level of your XML, 
one way to deal with an open-ended number of levels is to use recursion.

I apologize for not saying more, but I am running out the door, and don't have 
time to write up any kind of sample code on this. However, I'm sure that if you 
google for things like recursion or recursive function, you should find lots of 
information on how this approach works. I'd also guess that Wikipedia has a 
good article on this.

Hope that helps,


 Sid Maskit
Partner 
CraftySpace
Better Websites for a Better World
http://www.CraftySpace.com
blog: http://smaskit.blogspot.com/



----- Original Message ----
From: Patrick J. Jankun <[EMAIL PROTECTED]>
To: [email protected]
Sent: Sunday, September 7, 2008 4:30:50 AM
Subject: [flexcoders] XML Document and Navigation


Hello Everyone,

I run into a problem, something that probably a lot of people here knows how to 
solve.
But after sitting for 2 days building nestes for loops, i can't see the light 
by the end of the tunnel :-)

So, here is a problem:

I have to build an xml based navigation, so far, quite simple and clear. Made 
it already a few times,
but, now, this is a bit more complicated, because i got a much deeper nested 
sub levels, and i really
don't know how to efficient traverse the document and build the navigation out 
of it :|

The most complex navigation i made had 2 levels, so it wasn't really hard to 
imagine the code for this task:
2 for loops done the nav creation and that's it, but i got now, an "undefined" 
deep, and i don't know how to
bite the code that will build the nav, that goes a bit deeper then one-sub 
level.

Do you guys got any examples or thoughts on how to solve the task?
Im pretty sure that i got an logical error in my approach, since i will use 
some nested for loops, but i can't
think the "formula" since i don't know how deep each of the nodes goes, and 
this task gives me headaches.

any kind of help and pinpointing to right direction would be VERY appreciated

cheers,
Patrick


------------ --------- --------- --------- ---
fancy skills to pay the bills
www.jankun.org
 
Phone:  +43 660 96 969 - 01
web:    jankun.org
mail:   p[at]jankun. org 
    


      

Reply via email to