I'm trying to parse a rss feed that looks like this for the attribute "date":
<rss version="2.0">
<channel>
<item>
<y:c date="AA"></y:c>
</item>
</channel>
</rss>
I tried several different versions of this: (rssFeed contains the RSS data)
println(((rssFeed \\ "channel" \\ "item" \ "y:c" \"date").toString))
But nothing seems to work. What am I missing?
Any help would really be appreciated!
The "y" in <y:c
is a namespace prefix. It's not part of the name. Also, attributes are referred to with a '@'. Try this:
println(((rssFeed \\ "channel" \\ "item" \ "c" \ "@date").toString))
Attributes are retrieved using the "@attrName" selector. Thus, your selector should actually be something like the following:
println((rssFeed \\ "channel" \\ "item" \ "c" \ "@date").text)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With