Multiple <atom:link> elements in RSS feed - rss

I am working on a Drupal module proving RSS feed generation (though not posting it to Drupal Answers, as my question is not really Drupal-related).
What I am wondering is whether an RSS feed could have multiple <atom:link> elements? (Or any other element for that matter?)
For example, PubSubHubbub requires an <atom:link> with rel attributes set to hub and href pointing to feed's update hub.
On the other hand, the same <atom:link> could be used with rel attribute set to self and href pointing to feed's URL.
Which means, if I want to use both, I would need to include <atom:link> element twice in my feed. Or am I missing something here?

Yes, you can have multiple <atom:link> elements, each one would have a different rel attribute. That is valid Atom XML and customary practice.
You should review the Atom spec and the RSS spec, too.

Related

Ways to set thumbnail for an RSS feed item

Many feed readers seem to use different tags for thumbnails. What are some common ways of specifying thumbnails?
So far, I know about the enclosure tag, the media:thumbnail tag, embedding images directly in the item description, and using the og:image meta tag. What are ways are there?
Tehcnically, the only way to do it with pure RSS is <enclosure>. Now, the greatness of RSS is that it's (almost) XML, which means that you can extended with namespaces... whether they are existing namespaces (like MediaRSS) or completely custom ones.
As to what you should do:
try to avoid creating your own namespace because it's unlikely everyone else will do the work to support it.
Use MediaRSS: (media:thumbnail) specifically if you need it for more than just the thumbnail (like a larger image, or other media elements).
If you only need <enclosure> then, just use plain RSS: simpler is better!

Serve RSS feed with different languages for different items

Is it possible to create an RSS (2.0) feed with multiple languages? Say I blog mainly in English (en), but sometimes I create German (de) posts.
Is there support for this in the RSS spec? I couldn't find anything in the RSS spec on this issue.
There doesn't seem to be a language sub-element below item and I'm not sure if it's valid to put multiple language codes separated by comma in the language element of channel.
Actually I don't care too much about setting the language for specific items in the feed, but rather I'd like to specify a primary language and a secondary language.
The specific RSS <language> element is only valid at the top level and specifies:
The language the channel is written in.
Atom uses the more general xml:lang attribute and makes clear that in can be used on any element:
Any element defined by this specification MAY have an xml:lang
attribute, whose content indicates the natural language for the
element and its descendents.
It would be acceptable to use xml:lang on specific items in an RSS feed. However, with RSS or Atom, your decision will largely be affected by whether clients pay attention to it.

Why do Google News feeds have such strange structure?

I'm trying to incorporate a google news feed in my website (Using the built-in SimplePie functionality of WordPress).
However, the default feed gets rendered in a strange table structure. Sure enough, when I inspect the feed XML, I see that Google News has a whole bunch of table html as its 'description' element, complete with embedded styles, etc (See this example)- essentially dictating how the feed must be displayed, and not allowing for any effective css based customization.
This seems really dumb- can anyone help explain what is going on, or at least agree with me that this is just a terrible feed architecture?
Feeds often include html tags, as many (most?) readers will handle and use them, and that way the RSS provider can have some nice looking output in the reader, as you've guessed. (I prefer flagging it as CDATA unless it's proper xhtml, as it's not valid xml/rss otherwise). It's not in the original spirit of RSS perhapts, but the Google feed is just an extreme example of common practice. As per your problem, does strip_htmltags help (simplepie.org/wiki/reference/simplepie/strip_htmltags)?

What is usefulness of W3C's "Semantic Data Extractor" in semantically correct XHTML CSS Development?

What is the usefulness of W3C's Semantic Data Extractor?
http://www.w3.org/2003/12/semantic-extractor.html
This tool, geared by an XSLT
stylesheet, tries to extract some
information from a HTML semantic rich
document. It only uses information
available through a good usage of the
semantics defined in HTML.
The aim is to show that providing a
semantically rich HTML gives much more
value to your code: using a
semantically rich HTML code allows a
better use of CSS, makes your HTML
intelligible to a wider range of user
agents (especially search engines
bots).
As an aside, it can give clues to user
agents developers on some hooks that
could be interesting to add in their
product.
After checking validation for CSS and HTML. Should i go for Semantic Data Extractor tool.
What it does. and how it can improved our coding.? Is anyone using it?
And i check some site randomly with but with most of sites it gives error
Using org.apache.xerces.parsers.SAXParser
Exception net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException: The element type "input" must be terminated by the matching end-tag "`</input>`".
org.xml.sax.SAXParseException: The element type "input" must be terminated by the matching end-tag "`</input>`".
Is it possible to get validate every site with this tool?
After checking validation for CSS and HTML. Should i go for Semantic Data Extractor tool.
Probably not
What it does.
Exactly what you quoted from its homepage.
and how it can improved our coding.?
Other then hitting you over the head when you have problems counting heading levels; not a lot.
And i check some site randomly with but with most of sites it gives error
It depends on well formed and sane input.

How can I apply my CSS stylesheet to an RSS feed

On my blog I use some CSS classes which are defined in my stylesheet, but in RSS readers those styles don't show up. I had been searching for class="whatever" and replacing with style="something: something;". But this means whenever I modify my CSS I need to modify my RSS-generating code too, and it doesn't work for a tag which belongs to multiple classes (i.e. class="snapshot accent"). Is there any way to point to my stylesheet from my feed?
The popular RSS readers WILL NOT bother downloading a style sheet, even if you provide one and link to it using <?xml-stylesheet?>.
Many RSS readers simply strip all inline style attributes from your tags. From testing today, I discovered that Outlook 2007 seems to strip out all styles, for example, even if they are inline.
Good RSS readers allow a limited set of inline style attributes. See, for example, this article at Bloglines about what CSS they won't strip. From experimentation, Google Reader seems to pass through certain styles unharmed.
The philosophy of RSS is indeed that the reader is responsible for presentation. Many people think that RSS should be plain text and that CSS in RSS feeds is inappropriate. It's probably not appropriate to impose a different font on your RSS feeds. However, certain types of content (for example, images floated on the left, with captions positioned carefully) require a minimal amount of styling in order to maintain their semantic meaning.
The point of RSS is to be display agnostic. You should not be putting style attributes on your feed.
I found this blog post that describes how to add style to your RSS feed.
Because RSS is (supposed to be) XML, you can use XML stylesheets.
http://www.w3.org/TR/xml-stylesheet/
The purpose of an RSS feed is to allow the easy transmission of content to places outside your site. The whole idea is that the content within the feed is format-free, so that it can be read by any piece of software. The program that is reading the your feed is in charge of how to present it visually. For example, if you had a website that read RSS, you would want to parse the feed into HTML, and style it that way. However, if you were building a desktop application to read the feed, you would implement the formatting quite differently.

Resources