Forum OpenACS Q&A: Re: Reading a XML file from a web url

Collapse
Posted by Antonio Pisano on
Well, this something more related to plain tcl than OpenACS itself.

A very simple solution could be:

set formatted_address [string range $xml [expr [string first "<formatted_address>" + [string length "<formatted_address>"]] $xml] [string first "</formatted_address>" $xml]]

(didn't test, maybe there is a +1 to add somewhere in the indexes)

Other solutions could involve xml parsing, if you want to go that way, look for tdom, which is tcl's xml parsing toolkit.

As this is a very basic question for tcl, please allow me to point you to some useful resources. First one will probably give you all you need to know, even if it was written for an earlier version of tcl than current.

1) http://philip.greenspun.com/tcl/
2) http://wiki.tcl.tk/
3) http://tmml.sourceforge.net/doc/tcl/