Top Description Fields Constructors Methods
com.rometools.rome.io

public Class SyndFeedInput

extends Object
Class Inheritance
Imports
java.io.File, .FileNotFoundException, .IOException, .Reader, java.util.Locale, org.jdom2.Document, org.xml.sax.InputSource, com.rometools.rome.feed.synd.SyndFeed, .SyndFeedImpl

Parses an XML document (File, InputStream, Reader, W3C SAX InputSource, W3C DOM Document or JDom DOcument) into an SyndFeedImpl.

It delegates to a WireFeedInput to handle all feed types.

Field Summary

Modifier and TypeField and Description
private final WireFeedInput
private boolean

Constructor Summary

AccessConstructor and Description
public
SyndFeedInput()

Creates a SyndFeedInput instance with input validation turned off.

public
SyndFeedInput(final boolean
indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)
validate
,
final Locale locale)

Creates a SyndFeedInput instance.

Method Summary

Modifier and TypeMethod and Description
public SyndFeed

Returns:

the SyndFeedImpl read from the file.
build
(final File
file to read to create the SyndFeedImpl.
file
)

Builds SyndFeedImpl from a file.

public SyndFeed

Returns:

the SyndFeedImpl read from the Reader.
build
(final Reader
Reader to read to create the SyndFeedImpl.
reader
)

Builds SyndFeedImpl from an Reader.

public SyndFeed

Returns:

the SyndFeedImpl read from the W3C SAX InputSource.
build
(final InputSource
W3C SAX InputSource to read to create the SyndFeedImpl.
is
)

Builds SyndFeedImpl from an W3C SAX InputSource.

public SyndFeed

Returns:

the SyndFeedImpl read from the W3C DOM document.
build
(final Document
W3C DOM document to read to create the SyndFeedImpl.
document
)

Builds SyndFeedImpl from an W3C DOM document.

public SyndFeed

Returns:

the SyndFeedImpl read from the JDOM document.
build
(final Document
JDOM document to read to create the SyndFeedImpl.
document
)

Builds SyndFeedImpl from an JDOM document.

public boolean

Returns:

TRUE if healing is enabled, FALSE if not.
getXmlHealerOn
()

Indicates if the WiredFeedInput instance will XML heal (if necessary) the character stream.

public boolean

Returns:

true when Doctype declarations are allowed, false otherwise
isAllowDoctypes
()

Indicates whether Doctype declarations are allowed.

public boolean

Returns:

true if the WireFeed is made available in the SyndFeed. False by default.
isPreserveWireFeed
()

public void
setAllowDoctypes(boolean
true when Doctype declarations should be allowed again, false otherwise
allowDoctypes
)

Since ROME 1.5.1 we fixed a security vulnerability by disallowing Doctype declarations by default.

public void
setPreserveWireFeed(final boolean
set to true to make the WireFeed is made available in the SyndFeed. False by default.
preserveWireFeed
)

public void
setXmlHealerOn(final boolean
TRUE enables stream healing, FALSE disables it.
heals
)

Enables XML healing in the WiredFeedInput instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

feedInputback to summary
private final WireFeedInput feedInput
preserveWireFeedback to summary
private boolean preserveWireFeed

Constructor Detail

SyndFeedInputback to summary
public SyndFeedInput()

Creates a SyndFeedInput instance with input validation turned off.

SyndFeedInputback to summary
public SyndFeedInput(final boolean validate, final Locale locale)

Creates a SyndFeedInput instance.

Parameters
validate:boolean

indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)

Method Detail

buildback to summary
public SyndFeed build(final File file) throws FileNotFoundException, IOException, IllegalArgumentException, FeedException

Builds SyndFeedImpl from a file.

Parameters
file:File

file to read to create the SyndFeedImpl.

Returns:SyndFeed

the SyndFeedImpl read from the file.

Exceptions
FileNotFoundException:
thrown if the file could not be found.
IOException:
thrown if there is problem reading the file.
IllegalArgumentException:
thrown if feed type could not be understood by any of the underlying parsers.
FeedException:
if the feed could not be parsed
buildback to summary
public SyndFeed build(final Reader reader) throws IllegalArgumentException, FeedException

Builds SyndFeedImpl from an Reader.

Parameters
reader:Reader

Reader to read to create the SyndFeedImpl.

Returns:SyndFeed

the SyndFeedImpl read from the Reader.

Exceptions
IllegalArgumentException:
thrown if feed type could not be understood by any of the underlying parsers.
FeedException:
if the feed could not be parsed
buildback to summary
public SyndFeed build(final InputSource is) throws IllegalArgumentException, FeedException

Builds SyndFeedImpl from an W3C SAX InputSource.

Parameters
is:InputSource

W3C SAX InputSource to read to create the SyndFeedImpl.

Returns:SyndFeed

the SyndFeedImpl read from the W3C SAX InputSource.

Exceptions
IllegalArgumentException:
thrown if feed type could not be understood by any of the underlying parsers.
FeedException:
if the feed could not be parsed
buildback to summary
public SyndFeed build(final Document document) throws IllegalArgumentException, FeedException

Builds SyndFeedImpl from an W3C DOM document.

Parameters
document:Document

W3C DOM document to read to create the SyndFeedImpl.

Returns:SyndFeed

the SyndFeedImpl read from the W3C DOM document.

Exceptions
IllegalArgumentException:
thrown if feed type could not be understood by any of the underlying parsers.
FeedException:
if the feed could not be parsed
buildback to summary
public SyndFeed build(final Document document) throws IllegalArgumentException, FeedException

Builds SyndFeedImpl from an JDOM document.

Parameters
document:Document

JDOM document to read to create the SyndFeedImpl.

Returns:SyndFeed

the SyndFeedImpl read from the JDOM document.

Exceptions
IllegalArgumentException:
thrown if feed type could not be understood by any of the underlying parsers.
FeedException:
if the feed could not be parsed
getXmlHealerOnback to summary
public boolean getXmlHealerOn()

Indicates if the WiredFeedInput instance will XML heal (if necessary) the character stream.

Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog.

Healing resolves HTML entities (from literal to code number) in the reader.

The healing is done only with the build(File) and build(Reader) signatures.

By default is TRUE.

Returns:boolean

TRUE if healing is enabled, FALSE if not.

isAllowDoctypesback to summary
public boolean isAllowDoctypes()

Indicates whether Doctype declarations are allowed.

Returns:boolean

true when Doctype declarations are allowed, false otherwise

isPreserveWireFeedback to summary
public boolean isPreserveWireFeed()
Returns:boolean

true if the WireFeed is made available in the SyndFeed. False by default.

setAllowDoctypesback to summary
public void setAllowDoctypes(boolean allowDoctypes)

Since ROME 1.5.1 we fixed a security vulnerability by disallowing Doctype declarations by default. This change breaks the compatibility with at least RSS 0.91N because it requires a Doctype declaration. You are able to allow Doctype declarations again with this property. You should only activate it when the feeds that you process are absolutely trustful.

Parameters
allowDoctypes:boolean

true when Doctype declarations should be allowed again, false otherwise

setPreserveWireFeedback to summary
public void setPreserveWireFeed(final boolean preserveWireFeed)
Parameters
preserveWireFeed:boolean

set to true to make the WireFeed is made available in the SyndFeed. False by default.

setXmlHealerOnback to summary
public void setXmlHealerOn(final boolean heals)

Enables XML healing in the WiredFeedInput instance.

Healing trims leading chars from the stream (empty spaces and comments) until the XML prolog.

Healing resolves HTML entities (from literal to code number) in the reader.

The healing is done only with the build(File) and build(Reader) signatures.

By default is TRUE.

Parameters
heals:boolean

TRUE enables stream healing, FALSE disables it.