looping through a collection of elements

yea420

New member
Joined
Mar 14, 2005
Messages
1
Programming Experience
1-3
Hi everyone, and thanks in advance for your help. I'm pulling apart an xml document that's spit out by framemaker to make a new xml document. So what I have to do is loop through all the elements off the root and then go through a case structure (or something similiar) to logically define what to do with each element. Here is a simplified version of the xml:

<xml>
<title></title>
<title><page-number>This is the title</page-number>
</title>
<chapter><A id="no idea what this even is></A>Chapter 232</chapter>
<paragraph>This is a paragraph</paragraph>
<paragraph>This is another paragraph</paragraph>
<paragraph>And still more paragraphs</paragraph>
</xml>

Ok, after searchin examples over the old net I thought this would be easy. Unfortunately every time I try looping through nodes and such I get out put I'm not expecting. Here's the pseudo for what I want to do

Get all elements below /xml

Do while element
Select Case element
Case "title"
If not element is empty
lookup the page-number
End If
Case "chapter"
get rid of <A> element
Case "paragraph"
get paragraph text
End select
End While

So I'm not to concerned about the case statement but if someone can poin me in the right direction ro running through each element at a specific level, right under /xml, well,,, it would make my day :)
 
Top Bottom