Exemplo n.º 1
0
 private Date getPubDate(Item item) {
   String data = item.getPubDate().getText();
   SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH);
   Date x = new Date();
   try {
     x = new Date(sdf.parse(data).getTime());
   } catch (ParseException e) {
   }
   return x;
 }
Exemplo n.º 2
0
  private void addItem(Message m, Item i) throws NavajoException {
    Navajo n = m.getRootDoc();

    Message itemMessage =
        NavajoFactory.getInstance().createMessage(n, "Rss", Message.MSG_TYPE_ARRAY_ELEMENT);
    m.addMessage(itemMessage);
    addProperty(itemMessage, "Title", i.getTitle(), Property.STRING_PROPERTY);
    addProperty(itemMessage, "Link", i.getLink(), Property.STRING_PROPERTY);
    addProperty(itemMessage, "Description", i.getDescription(), Property.MEMO_PROPERTY);
    addProperty(itemMessage, "Author", i.getAuthor(), Property.STRING_PROPERTY);
    addProperty(itemMessage, "PubDate", i.getPubDate(), Property.STRING_PROPERTY);
    addProperty(itemMessage, "Source", i.getSource(), Property.STRING_PROPERTY);
  }