Xml deep parse question

I have search and read the most post’s in the forum but i am still a bit confused.
If i know how deep is the xml file i do with a simple recursion.
If you don’t know how deep is the xml file how to i go deeper to get the names and values??

try ‘XMLExample’ in the Xojo Examples Folder (/Example Projects/Text/)

Thank you Axel but the XMLexample is based on the listbox and is more confuse to me.The reason is i don’t have listbox in my app (because i am not familiar) only simple textfields.Because i am the beginning with Xojo i prefer the loop count procedure… :wink:

Sounds like you need an example of recursion rather than XML itself.
usually if you are going to use an XML file, you have an understanding of the contents before you start.
if not, then you need to treat the XML file a little like a hierarchical listbox.

You start by creating a method that looks at the children of a node which is passed in as a parameter
Loop through the children, and every time you find a child that has children, call the same routine recursively

pseudocode :

[code]sub ParseNode(n as XMLNode)

for each childnode in n.children

// report on the name of childnode

if (the child node has children of its own,) then
ParseNode (childnode) //handles nested items
end if

next //child

end sub[/code]

Maybe you don’t need that kind of recursion by using XQL. It makes really simple to access the nodes you are interested in!

You can see my last tutorial. It is in Spanish but I think that you can easily grasp how XQL works.

Hope it helps.

Javier Rodrguez
Evangelista Xojo en Espaol
Autor del Libro “Programacin Multiplataforma Xojo

Thank you Jeff and Javier.
Jeff i use similar to the pseudocode you write but with for… next loop i will try for each,to see it.
Javier really interesting the xql,i will try to see the video on youtube.
Thank you for the help guys!!

Does that help? ParseXML