Hey everyone, I was wondering if a script existed, or if some people are willing to work together to create a script that can easily parse a XML files, and then display the contents in the channel whenever that XML files is updated. It's also important that this script is able to support multiple sites. Thx you =).
Generic xml parsing is not easy (in any language). The parser needs to know what attributes/text nodes you want and where to find them in the structure. Also, Tcl is badly suited for manipulating these multidimensional structures. There are, however, several packages for parsing xml in tcl. Try your favourite search engine.
I was only able to find general information on the web, but no good examples. Since a general parser doesn't seem possible, could someone send me their code for one specific xml file and I could learn from that and edit it from there.
1. Get code to download the xml file -- http.tcl should work fine
2. Figure out how to tell when the file has changed (look at http headers? compare files? several methods here)
3. Get code to parse the xml -- a simple google search reveals a bunch, tclxml.sourceforge.net is one example
4. Combine code for desired script
By far the best way would be to find an XML parser written in C, compile it as a TCL module and then write hooks from TCL to the C library. Trying to write an XML parser in TCL is tantamount to reinventing the wheel. And the wheel wouldn't go round very fast, either.