org.apache.commons.feedparser
Class ContentDetector

java.lang.Object
  extended by org.apache.commons.feedparser.ContentDetector

public class ContentDetector
extends Object

Given the RAW content of a URL, determine if we're looking at an RSS file or an HTML file. We also return the given RSS version or Atom version.

Version:
$Id: ContentDetector.java 373614 2006-01-30 22:31:21Z mvdb $
Author:
Kevin A. Burton (burtonator)

Constructor Summary
ContentDetector()
           
 
Method Summary
static ContentDetectorResult detect(String content)
          Return true if the given content seems to be RSS.
static boolean isAtomContent(String content)
           
static boolean isHTMLContent(String content)
          Return true if this is RSS 2.0 content
static boolean isRSS_0_9_0_Content(String content)
          Return true if this is RSS 2.0 content
static boolean isRSS_0_9_1_Content(String content)
          Return true if this is RSS 2.0 content
static boolean isRSS_0_9_2_Content(String content)
          Return true if this is RSS 0.9.2 content
static boolean isRSS_1_0_Content(String content)
          Return true if this is RSS 1.0 content
static boolean isRSS_2_0_Content(String content)
          Return true if this is RSS 2.0 content
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentDetector

public ContentDetector()
Method Detail

detect

public static ContentDetectorResult detect(String content)
                                    throws Exception
Return true if the given content seems to be RSS. This is going to be a cheat because really we have no way of telling if this is RSS other than if it is XML and it starts with an RSS 1.0, 2.0, 0.91 or 0.9 decl

Throws:
Exception

isRSS_1_0_Content

public static boolean isRSS_1_0_Content(String content)
                                 throws Exception
Return true if this is RSS 1.0 content

Throws:
Exception

isRSS_0_9_1_Content

public static boolean isRSS_0_9_1_Content(String content)
                                   throws Exception
Return true if this is RSS 2.0 content

Throws:
Exception

isRSS_0_9_2_Content

public static boolean isRSS_0_9_2_Content(String content)
                                   throws Exception
Return true if this is RSS 0.9.2 content

Throws:
Exception

isRSS_2_0_Content

public static boolean isRSS_2_0_Content(String content)
                                 throws Exception
Return true if this is RSS 2.0 content

Throws:
Exception

isRSS_0_9_0_Content

public static boolean isRSS_0_9_0_Content(String content)
                                   throws Exception
Return true if this is RSS 2.0 content

Throws:
Exception

isAtomContent

public static boolean isAtomContent(String content)
                             throws Exception
Throws:
Exception

isHTMLContent

public static boolean isHTMLContent(String content)
                             throws Exception
Return true if this is RSS 2.0 content

Throws:
Exception

main

public static void main(String[] args)


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.