Package com.rometools.rome.io
Class SyndFeedInput
- java.lang.Object
-
- com.rometools.rome.io.SyndFeedInput
-
public class SyndFeedInput extends Object
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.
-
-
Constructor Summary
Constructors Constructor Description SyndFeedInput()Creates a SyndFeedInput instance with input validation turned off.SyndFeedInput(boolean validate, Locale locale)Creates a SyndFeedInput instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SyndFeedbuild(File file)Builds SyndFeedImpl from a file.SyndFeedbuild(Reader reader)Builds SyndFeedImpl from an Reader.SyndFeedbuild(org.jdom2.Document document)Builds SyndFeedImpl from an JDOM document.SyndFeedbuild(Document document)Builds SyndFeedImpl from an W3C DOM document.SyndFeedbuild(InputSource is)Builds SyndFeedImpl from an W3C SAX InputSource.booleangetXmlHealerOn()Indicates if the WiredFeedInput instance will XML heal (if necessary) the character stream.booleanisAllowDoctypes()Indicates whether Doctype declarations are allowed.booleanisPreserveWireFeed()voidsetAllowDoctypes(boolean allowDoctypes)Since ROME 1.5.1 we fixed a security vulnerability by disallowing Doctype declarations by default.voidsetPreserveWireFeed(boolean preserveWireFeed)voidsetXmlHealerOn(boolean heals)Enables XML healing in the WiredFeedInput instance.
-
-
-
Constructor Detail
-
SyndFeedInput
public SyndFeedInput()
Creates a SyndFeedInput instance with input validation turned off.
-
SyndFeedInput
public SyndFeedInput(boolean validate, Locale locale)Creates a SyndFeedInput instance.- Parameters:
validate- indicates if the input should be validated. NOT IMPLEMENTED YET (validation does not happen)
-
-
Method Detail
-
setXmlHealerOn
public void setXmlHealerOn(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- TRUE enables stream healing, FALSE disables it.
-
getXmlHealerOn
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:
- TRUE if healing is enabled, FALSE if not.
-
isAllowDoctypes
public boolean isAllowDoctypes()
Indicates whether Doctype declarations are allowed.- Returns:
- true when Doctype declarations are allowed, false otherwise
-
setAllowDoctypes
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- true when Doctype declarations should be allowed again, false otherwise
-
build
public SyndFeed build(File file) throws FileNotFoundException, IOException, IllegalArgumentException, FeedException
Builds SyndFeedImpl from a file.- Parameters:
file- file to read to create the SyndFeedImpl.- Returns:
- the SyndFeedImpl read from the file.
- Throws:
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
-
build
public SyndFeed build(Reader reader) throws IllegalArgumentException, FeedException
Builds SyndFeedImpl from an Reader.- Parameters:
reader- Reader to read to create the SyndFeedImpl.- Returns:
- the SyndFeedImpl read from the Reader.
- Throws:
IllegalArgumentException- thrown if feed type could not be understood by any of the underlying parsers.FeedException- if the feed could not be parsed
-
build
public SyndFeed build(InputSource is) throws IllegalArgumentException, FeedException
Builds SyndFeedImpl from an W3C SAX InputSource.- Parameters:
is- W3C SAX InputSource to read to create the SyndFeedImpl.- Returns:
- the SyndFeedImpl read from the W3C SAX InputSource.
- Throws:
IllegalArgumentException- thrown if feed type could not be understood by any of the underlying parsers.FeedException- if the feed could not be parsed
-
build
public SyndFeed build(Document document) throws IllegalArgumentException, FeedException
Builds SyndFeedImpl from an W3C DOM document.- Parameters:
document- W3C DOM document to read to create the SyndFeedImpl.- Returns:
- the SyndFeedImpl read from the W3C DOM document.
- Throws:
IllegalArgumentException- thrown if feed type could not be understood by any of the underlying parsers.FeedException- if the feed could not be parsed
-
build
public SyndFeed build(org.jdom2.Document document) throws IllegalArgumentException, FeedException
Builds SyndFeedImpl from an JDOM document.- Parameters:
document- JDOM document to read to create the SyndFeedImpl.- Returns:
- the SyndFeedImpl read from the JDOM document.
- Throws:
IllegalArgumentException- thrown if feed type could not be understood by any of the underlying parsers.FeedException- if the feed could not be parsed
-
isPreserveWireFeed
public boolean isPreserveWireFeed()
- Returns:
- true if the WireFeed is made available in the SyndFeed. False by default.
-
setPreserveWireFeed
public void setPreserveWireFeed(boolean preserveWireFeed)
- Parameters:
preserveWireFeed- set to true to make the WireFeed is made available in the SyndFeed. False by default.
-
-