FeedTools syntax question


#1

in the above feed, can anyone tell me how to access the
openSearch:totalResults element using feed tools? I can access the other
elements, but I’m unsure what special meaning the colon carries or how
to
work with such items in feedtools

thanks in advance
al


#2

“Alan B.” removed_email_address@domain.invalid wrote

http://www.mozdex.com/open.jsp?query=webhosting&start=10

whilst I’m on the topic of feedtools, has anyone been able to use it
with
the google web results from opensearch? I can’t find the URL for the rss
feed for it…


#3

The colon in an xml tag signifies a namespace. “openSearch” would be the
namespace prefix
and all tags in the document with that prefix are in that namespace.

If you look at the root element it declares the namespace:

xmlns:openSearch=“http://a9.com/-/spec/opensearchrss/1.0/

Note that the URL there is just being used as a URI… a unique
identifier for the
namespace. Giving it the prefix allows you to use the prefix in the tags
instead of having
to stick that whole URI in every tag in the namespace.

I don’t know anything about feedtools, but hopefully it has some
facility for dealing with
namespaces… Any decent XML library should.

b


#4

http://www.mozdex.com/open.jsp?query=webhosting&start=10

in the above feed, can anyone tell me how to access the
openSearch:totalResults element using feed tools? I can access the other
elements, but I’m unsure what special meaning the colon carries or how
to work with such items in feedtools
feed =
FeedTools::Feed.open(‘http://www.mozdex.com/open.jsp?query=webhosting&start=10’)
puts feed.find_node(‘openSearch:totalResults’).text

‘feed’ can be used as a simple REXML object