This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Simple XML parser - there must be a way!!!

Old posts that have not been replied to for several years.
Locked
t
tonyrayo
Voice
Posts: 20
Joined: Thu Jul 31, 2003 3:29 pm
Location: Waldorf, MD
Contact:

Simple XML parser - there must be a way!!!

Post by tonyrayo »

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 =).
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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.
t
tonyrayo
Voice
Posts: 20
Joined: Thu Jul 31, 2003 3:29 pm
Location: Waldorf, MD
Contact:

Post by tonyrayo »

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.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Try googling for the 'tcllib' package .. I think I saw the beginnings of an XML parser in there a while back.
t
tonyrayo
Voice
Posts: 20
Joined: Thu Jul 31, 2003 3:29 pm
Location: Waldorf, MD
Contact:

Post by tonyrayo »

http://tcllib.sourceforge.net/doc/index.html <= it does a lot of impressive stuff, but nothing with XML.+
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Recipe for your script

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
D
DJGrenola
Voice
Posts: 14
Joined: Sun Aug 24, 2003 12:57 pm

C

Post by DJGrenola »

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.
Locked