Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

evaluating expression with an object

Status
Not open for further replies.

ryan101

Programmer
Jul 11, 2001
13
US
I need to call multiple trees in an xml document. The call for a single tree is simple. I just define tree as an object that points to the document and...

set branch1 = tree.item(0).childNodes
set branch2 = tree.item(1).childNodes
...etc...

I need to have a loop that does something like this.

for x = 0 to something.length
set branch = tree.item(x).childNodes
do something with branch
next

I've tried doing the following:
set branch = eval("tree.item(" & x & ")childNodes")
eval("set branch = tree.item(" & x & ")childNodes")
execute("set branch = tree.item(" & x & ")childNodes")

none of those seemed to work. I don't think this is an xml specific issue. I just need to figure out how to set objects using variables and loops.
 
What you need is an array of objects so that you can refer to them ordinally as you have the items in your tree.

dim branchArray(n)

for i = 0 to n
set branchArray(i) = tree.item(i).childNodes
next

Something along those lines. I'm not familiar with XML, but this method does work for things like recordsets, etc...

:)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top