Пример #1
0
 public void endElement(String qName) throws SAXException {
   super.endElement(qName);
   // Mandatory
   if (qName.equals(TITLE)) {
     item.setTitle(getBuffer().toString());
   }
   if (qName.equals(SUMMARY)) {
     item.internalSetText(getBuffer().toString());
   }
   if (qName.equals(CONTENT)) {
     item.internalSetText(getBuffer().toString());
   }
   if (qName.equals(ID)) {
     item.setGuid(getBuffer().toString());
   }
   // RFC822 date specification
   if (qName.equals(PUBLISHED)) {
     item.setPublicationDate(parse(getBuffer().toString()).getTime());
   }
   if (qName.equals(ENTRY)) {
     if (!collection.hasArticle(item.getGuid())) {
       addArticle(item);
     }
   }
 }
Пример #2
0
 public IElementHandler startElement(String qName, Attributes atts) throws SAXException {
   super.startElement(qName, atts);
   if (qName.equals(TITLE)
       || qName.equals(SUMMARY)
       || qName.equals(PUBLISHED)
       || qName.equals(ID)
       || qName.equals(CONTENT)
       || qName.equals(UPDATED)) {
     setCapture(true);
   } else {
     setCapture(false);
   }
   if (qName.equals("source")) {
     return new AtomItemSourceHandler(collection, feed);
   }
   if (qName.equals("category")) {
     // FIXME: This should strictly be handled by the synchronizer
     String term = atts.getValue("term");
     String label = atts.getValue("label");
     if (term != null && term.endsWith("/state/com.google/read")) {
       if (label != null && label.equals("read")) {
         item.setRead(true);
       }
     } else if (term != null && term.endsWith("/state/com.google/starred")) {
       if (label != null && label.equals("starred")) {
         item.setStarred(true);
       }
     } else {
       if (term.contains("/label/")) {
         item.addLabel(label);
       }
     }
   }
   // Must exist if there is not a "content" element
   if (qName.equals(LINK)) {
     item.setLink(atts.getValue("href")); // $NON-NLS-1$
   }
   return this;
 }