| View previous topic :: View next topic |
| Author |
Message |
Kev Voice
Joined: 08 Sep 2005 Posts: 2
|
Posted: Thu Sep 08, 2005 10:55 pm Post subject: rss feed help |
|
|
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 !!  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Sep 08, 2005 11:38 pm Post subject: |
|
|
| Code: |
regexp {(?i)<category.*?>(.*?)</category>} $item -> item
|
|
|
| Back to top |
|
 |
Kev Voice
Joined: 08 Sep 2005 Posts: 2
|
Posted: Fri Sep 09, 2005 7:39 am Post subject: |
|
|
| thanks, works like a charm ! |
|
| Back to top |
|
 |
|