Use Informa library to create, not parse

  • Ignacio de Cordoba

    Hi there,
    I am using Informa library to parse RSS feeds with no problem.
    Now I want to generate RSS feeds using Informa. I am having a problem with ItemIF and inmemory Item object. How am I suppoused to set the content of a Item? I see Item has getElementValue() method but can't see the equivalent to set/add elements in an Item.
    I don't see it either in the ChannelCreator class.
    Thanks a lot for any directions. I don't know where else to search.


    • Niko Schmuck

      Niko Schmuck - 2005-05-11

      If I understand you properly, you are looking for something like ItemIF#setDescription(String).

      Please have a look at the JavaDoc


    • Ignacio de Cordoba

      Thanks Niko,
      I already so setter and getters for item title and item description, but as I understand RSS, an Item has a title, a description and then contains "Elements", which allow you to publish in the RSS item the different text blocks / images / ... what ever...
      In the API there is a getter to get those elements when you get the Item from an existing XML feed, but I see no setter to add elements to an item I create from scratch (a part, of course, from the estndar title and description properties of every item).
      I need to find some kind of item.setElement(...) method, or the way to add elements to the item.

      thanks for any help,

    • Brian Pipa

      Brian Pipa - 2005-07-13

      Not sure if this helps or not, but here is working code that creates a feed. You hsould be able ot figure out what you need to do from this:

      import de.nava.informa.impl.basic.*;
      import de.nava.informa.core.*;
      import de.nava.informa.exporters.*;

      public class RSSTest {
          public static void main(String[] args)
                  throws InstantiationException, ClassNotFoundException,
                  IllegalAccessException, Exception {

              ChannelBuilder builder = new ChannelBuilder();
              String chanName = "testchannelname";
              ChannelIF channel = builder.createChannel(chanName);
              channel.setDescription("Test Channel: " + chanName);
              ItemIF item1 = builder.createItem(channel, "Item 1 for " + chanName,
                      "First one", new URL(""));
              ItemIF item2 = builder.createItem(channel, "Item 2 for " + chanName,
                      "Second one", new URL(""));
              ChannelExporterIF exporter = new RSS_1_0_Exporter("rss.1.0.xml");
              // assuming you have a ChannelIF object available as channel

              exporter = new RSS_0_91_Exporter("rss.0.91.xml");
              // assuming you have a ChannelIF object available as channel



Log in to post a comment.