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.

rss feed help

Old posts that have not been replied to for several years.
Locked
K
Kev
Voice
Posts: 2
Joined: Thu Sep 08, 2005 10:52 pm

rss feed help

Post by Kev »

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: Select all

  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: Select all

      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 !! :D
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

regexp {(?i)<category.*?>(.*?)</category>} $item -> item
K
Kev
Voice
Posts: 2
Joined: Thu Sep 08, 2005 10:52 pm

Post by Kev »

thanks, works like a charm !
Locked