views:

101

answers:

1

I want to use Project Rome to create an RSS feed, using the code from the tutorial as base. I would like to add a pubsubhubbub discovery link, but there doesn't seem to be a general way to do so.

I can use a Link object if I create an atom feed (which I don't want to limit myself to), or I can just add foreign markup, like this:

// import org.jdom.Element

Element element = new Element("link");
element.setAttribute("rel", "hub");
element.setAttribute("href", "https://myhub.example.com/endpoint");

feed.setForeignMarkup(Arrays.asList(element));

But it feels ugly.

Is this really the best way to do this?

+1  A: 

I'm not very familiar with Rome, but I guess it works. If you indeed your RSS (and not ATOM), make sure you:

  • Dont forget to add the Atom namespace to this <link> item (which isn't part of the RSS2.0 spec
  • Add another link (Atom too) with rel = "self" which points to the corresponding url.

Finally, you may want to edit your title by adding "hubbub" to "pubsub", since PubSub is more general and is more often used in the context of XMPP XEP 060.

Julien Genestoux