PDA

View Full Version : is this an XML bug...?


holtgrewe
10-28-2009, 02:21 PM
There didn't appear to be much in the forum on XML or I just missed it...

This works fine:
-- Gets the second customer's second phone number.
customer_phone = XML.GetValue("database/customer:2/phone:2");

This doesn't work:
-- Gets the second customer's second phone number.
x=2
customer_phone = XML.GetValue("database/customer:x/phone:x");

I am having issues with looping thru XML...the XML indexing doesn't seem to work with anything other than an actual integer...

any ideas...?

reteset
10-28-2009, 02:46 PM
your variable X in string form in your second example

it should be something like this

min = 1;
max = 10;

for i = min, max do

customer_phone = XML.GetValue("database/customer:"..i.."/phone:"..i);
ListBox.AddItem("ListBox1", customer_phone, "");

end

holtgrewe
10-28-2009, 02:48 PM
...just found it.

customer_phone = XML.GetValue("database/customer:"..x.."/phone:"..x");

...and thanks Reteset

senility is rapidly taking its toll on me...