Package com.substanceofcode.rssreader.businessentities

Examples of com.substanceofcode.rssreader.businessentities.RssItunesFeed


           
      boolean bodyFound = false;
            do {
        if (elementType == HTMLParser.REDIRECT_URL) {
          RssItunesFeed [] feeds = new RssItunesFeed[1];
          feeds[0] = new RssItunesFeed("", parser.getRedirectUrl(),
              "", "");
          return feeds;
        }
        /** RSS item properties */
        String title = "";
        String link = "";
                       
        String tagName = parser.getName();
        //#ifdef DLOGGING
//@        if (finerLoggable) {logger.finer("tagname: " + tagName);}
        //#endif
        if (tagName.length() == 0) {
          continue;
        }
        switch (tagName.charAt(0)) {
          case 'm':
          case 'M':
            if (bodyFound) {
              break;
            }
            break;
          case 'b':
          case 'B':
            if (!bodyFound) {
              bodyFound = parser.isBodyFound();
            }
            break;
          case 'a':
          case 'A':
            //#ifdef DLOGGING
//@            if (finerLoggable) {logger.finer("Parsing <a> tag");}
            //#endif
           
            title = parser.getText();
            // Title can be 0 as this is used also for
            // getting
            title = title.trim();
            title = StringUtil.removeHtml( title );

            if (((link = parser.getAttributeValue( "href" ))
                  == null) || ( link.length() == 0 )) {
              continue;
            }
            link = link.trim();
            if ( link.length() == 0 ) {
              continue;
            }
            if (link.indexOf("://") >= 0) {
              if (!link.startsWith("http:") &&
                !link.startsWith("https:") &&
                !link.startsWith("file:") &&
                 !link.startsWith("jar:")) {
                //#ifdef DLOGGING
//@                if (finerLoggable) {logger.finer("Not support for protocol or no protocol=" + link);}
                //#endif
                continue;
              }
            } else {
              if (link.charAt(0) == '/') {
                int purl = url.indexOf("://");
                if ((purl + 4) >= url.length()) {
                  //#ifdef DLOGGING
//@                  if (finerLoggable) {logger.finer("Url too short=" + url + "," + purl);}
                  //#endif
                  continue;
                }
                int pslash = url.indexOf("/", purl + 3);
                String burl = url;
                if (pslash >= 0) {
                  burl = url.substring(0, pslash);
                }
                link = burl + link;
              } else {
                link = url + "/" + link;
              }
            }
           
            /** Debugging information */
            //#ifdef DLOGGING
//@            if (finerLoggable) {logger.finer("Title:       " + title);}
//@            if (finerLoggable) {logger.finer("Link:        " + link);}
            //#endif
            if (( feedURLFilter != null) &&
              ( link.toLowerCase().indexOf(feedURLFilter) < 0)) {
              continue;
            }
           
            if (( feedNameFilter != null) &&
              ((title != null) &&
              (title.toLowerCase().indexOf(feedNameFilter) < 0))) {
              continue;
            }
            RssItunesFeed feed = new RssItunesFeed(title, link, "", "");
            rssFeeds.addElement( feed );
            break;
          default:
        }
            }
View Full Code Here


//@      System.out.println("Adding: " + name);
      //#endif
      // If no title (name) and we are getting the title from the
      // feed being imported, parse the name(title) only.
      if (((name == null) || (name.length() == 0)) && m_getFeedTitleList) {
        RssItunesFeed feed = feeds[feedIndex];
        RssFeedParser fparser = new RssFeedParser( feed );
        /* Loading title for */
        m_loadForm.appendMsg(ResourceProviderME.get("text.ld.t",
              feed.getUrl()));
        //#ifdef DLOGGING
//@        if (m_finestLoggable) {m_logger.finest("Getting title for url=" + feed.getUrl());}
        //#endif
        fparser.setGetTitleOnly(true);
        /** Get RSS feed */
        int maxItemCount = m_appSettings.getMaximumItemCountInFeed();
        try {
          fparser.parseRssFeed( false, true, maxItemCount );
          name = feed.getName();
          m_loadForm.appendMsg("ok\n");
        } catch(Exception ex) {
          m_midlet.recordExcForm("Error loading title for feed " +
              feed.getUrl(), ex);
          notesShown = true;
        }
      }
      if((name != null) && (name.length()>0)) {
        final boolean pres = m_rssFeeds.containsKey( name );
View Full Code Here

          }
          if (( m_feedURLFilter != null) &&
            ( link.toLowerCase().indexOf(m_feedURLFilter) < 0)) {
            continue;
          }
          RssItunesFeed feed = new RssItunesFeed(title, link, "", "");
          rssFeeds.addElement( feed );
        }
       
      }
            while( parser.parse() != XmlParser.END_DOCUMENT );
View Full Code Here

  private void parseHTMLRedirect(boolean updFeed, String url,
                   InputStream is, final boolean convXmlEnts,
                   final int maxItemCount)
  throws IOException, CauseException, Exception {
    String newUrl = super.parseHTMLRedirect(url, is);
    RssItunesFeed svFeed = new RssItunesFeed(m_rssFeed);
    parseRssFeedUrl(newUrl, updFeed, convXmlEnts, maxItemCount);
  }
View Full Code Here

  throws CauseMemoryException, CauseException {
    Object obj = super.get(name);
    if (obj == null) {
      return null;
    }
    RssItunesFeed cfeed = null;
    String cstore = null;
    if (obj instanceof RssItunesFeed) {
      if (getStore) {
        cstore = ((RssItunesFeed)obj).getStoreString(true, true, false);
      } else {
View Full Code Here

  throws CauseMemoryException, CauseException {
    Enumeration keyEnum = super.keys();
    int ic = 1;
    while(keyEnum.hasMoreElements()) {
      final String fname = (String)keyEnum.nextElement();
      RssItunesFeed feed = (RssItunesFeed)get(fname);
      feed.setItems(null);
      feed.setItems(new Vector());
      put(fname, feed);
    }
  }
View Full Code Here

//@                null,
                //#endif
                sitems );
          }
        } else {
          final RssItunesFeed feed =
            (RssItunesFeed)rssFeeds.getRo(fname);
          final Vector vitems = feed.getItems();
          final int ilen = vitems.size();
          if (ilen > 0) {
            RssItunesItem[] ritems = new RssItunesItem[ilen];
            vitems.copyInto(ritems);
            /**
 
View Full Code Here

TOP

Related Classes of com.substanceofcode.rssreader.businessentities.RssItunesFeed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.