Domanda

I'm using an XML RSS 2.0 feed from a third party site, to import news to an iPhone application. It all works fine however the RSS feed isn't very helpful for the user, as they have huge descriptions, and the feed dates back to over a year ago. Suffice to say, the mobile network doesn't like it.

I've been looking for a way to reduce this, and before with XML feeds I would usually add a URL parameter like ?limit=10 and so on and so forth. I'm guessing this was due to wordpress/twitter etc having an API to help me out?

I'm about to write my own online parser which will format the 3rd party XML file, and then pass it back all nice and formatted with this extensions, but before that is there a really trivial way of doing this that I've somehow missed during my research?

Thanks! rocky

edit - sorry here the RSS feed for reference http://www.nexus.org.uk/news.xml

È stato utile?

Soluzione 2

Found a neat little tool from Yahoo. Yahoo Pipes. I'm able to drop XML into the pipe, and then choose to render it via JSON, where I can use the "count":10 to reduce the feed, doing tests the file seems to be around 40kb. Which is much better than 794kb it use to send down.

It still doesn't limit the description, but I can live with that.

Altri suggerimenti

You can use some streaming XML parser to read feed until you reach the limit of items you want to show to your user.

  1. Open connection to the HTTP server.
  2. Start reading the stream until you fully read a feed item.
  3. If you reached number of items then abort connection, otherwise return to step 2.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top