axnpictures
Programmer
I want to print a regexp variable inside a loop from an xml file.
I'm reading the xml file through http.
This an example of my xml file:
<name>foo</name>
<name>foo1</name>
I'm using this tcl code:
foreach line $html {
regexp "<(name)>(.*?)</name>" $line dummy tag name
}
The problem is, I can only print $name outside the foreach loop and when I do, only the last line is shown.
If I try to print it inside the loop, I get "can't read $name no such variable".
I need to print it inside the loop in order to show all the xml document's lines.
How can I do that?
Thanks,
Alin
I'm reading the xml file through http.
This an example of my xml file:
<name>foo</name>
<name>foo1</name>
I'm using this tcl code:
foreach line $html {
regexp "<(name)>(.*?)</name>" $line dummy tag name
}
The problem is, I can only print $name outside the foreach loop and when I do, only the last line is shown.
If I try to print it inside the loop, I get "can't read $name no such variable".
I need to print it inside the loop in order to show all the xml document's lines.
How can I do that?
Thanks,
Alin