egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

rss feed help

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
Kev
Voice


Joined: 08 Sep 2005
Posts: 2

PostPosted: Thu Sep 08, 2005 10:55 pm    Post subject: rss feed help Reply with quote

heya

i'm trying to create a script which reads xml data..
now there's a tag <category> in the xml file but it's something like:

<category domain="http://www.test.be/view.php?sub=4">Album</category>

i would want to retrieve the word Album, the text between the tags

when i use:

Code:
  set count 0
  set item 0
  foreach line [split $data \n] {
    regsub -all "\\&" $line "\\\\&" line
    if {[regexp "<item>" $line]} { set item 1 }
    if {[regexp "</item>" $line]} { set item 0 }
    if {$item == 1} {
      regexp "<title>(.*)</title>" $line trash zvdata(title,$count)
      regexp "<category domain=(.*)>(.*)</category>" $line trash zvdata(category,$count)
      if {[regexp "<pubDate>(.*)</pubDate>" $line trash zvdata(date,$count)]} { incr count }
    }


Code:
      regexp "<category domain=(.*)>(.*)</category>" $line trash zvdata(category,$count)


> gives me the url that's used for domain

how can i get the category?

thanks in advance !! Very Happy
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Sep 08, 2005 11:38 pm    Post subject: Reply with quote

Code:

regexp {(?i)<category.*?>(.*?)</category>} $item -> item
Back to top
View user's profile Send private message Visit poster's website
Kev
Voice


Joined: 08 Sep 2005
Posts: 2

PostPosted: Fri Sep 09, 2005 7:39 am    Post subject: Reply with quote

thanks, works like a charm !
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber