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.

TCL Parsing - Has It Improved?

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:

TCL Parsing - Has It Improved?

Post by tonyrayo »

I have brought this topic up in the past, but was told there wasn't proper support for it to work. I was wondering if anyone has seen/used a script that would be able to parse/display xml and/or rdf and/or rss files. There must be a simple set of rules that could be set, or even if you needed to customize a file for a specific website, I am looking for detailed information on how this could be done. Thank you - Tony.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: TCL Parsing - Has It Improved?

Post by user »

Parsing rss can be done pretty easily because of the predefined structure.
Here's a quick example to get you started:

Code: Select all

# fetch the channel element...
if {[regexp -nocase {<channel>.+?</channel>} $xml xml]} {
  # loop through the items:
  foreach item [regexp -all -inline -nocase {<item>.+?</item>} $xml] {
    # extract what ever you need from each item in here :)
  }
} else {
  # no/empty channel element - what to do?
}
Have you ever read "The Manual"?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Generic XML can be parsed with SXML parser (available on THIS page).

There are also a lot of other libraries that can help, including a Tcl wrapper for Expat.
t
tonyrayo
Voice
Posts: 20
Joined: Thu Jul 31, 2003 3:29 pm
Location: Waldorf, MD
Contact:

Post by tonyrayo »

Hmm, I wish I had time to learn tcl, I was hoping there was already an eggdrop coded template for this, but thank you for the help regardless fokes, I will try and work with it :) .
Locked