org.apache.abdera.util
Class AbstractParserOptions

java.lang.Object
  extended by org.apache.abdera.util.AbstractParserOptions
All Implemented Interfaces:
java.lang.Cloneable, ParserOptions

public abstract class AbstractParserOptions
extends java.lang.Object
implements ParserOptions, java.lang.Cloneable

Non thread-safe abstract implementation of ParserOptions


Field Summary
protected  java.lang.String charset
           
protected  CompressionUtil.CompressionCodec[] codecs
           
protected  boolean detect
           
protected  Factory factory
           
protected  boolean filterreserved
           
protected  ParseFilter parseFilter
           
protected  boolean preserve
           
protected  char replacement
           
 
Constructor Summary
AbstractParserOptions()
           
 
Method Summary
protected abstract  void checkFactory(Factory factory)
           
 java.lang.Object clone()
           
 boolean getAutodetectCharset()
          Returns true if the parser should attempt to automatically detect the character encoding from the stream
 java.lang.String getCharset()
          Returns the default character set to use for the parsed document
 CompressionUtil.CompressionCodec[] getCompressionCodecs()
          When parsing an InputStream that contains compressed data, use these codecs to decompress the stream.
 Factory getFactory()
          Returns the factory the parser should use
 char getFilterRestrictedCharacterReplacement()
          If getFilterRestrictedCharacters is true, restricted characters will be replaced with the specified character
 boolean getFilterRestrictedCharacters()
          If true, the parser will attempt to silently filter out invalid XML characters appearing within the XML document.
 boolean getMustPreserveWhitespace()
          If false, the parser will trim leading and trailing whitespace in element and attribute values unless there is an in-scope xml:space="preserve".
 ParseFilter getParseFilter()
          Returns the Parse Filter.
protected abstract  void initFactory()
           
 void setAutodetectCharset(boolean detect)
          If true, the parser will attempt to automatically detect the character encoding from the stream by checking for the byte order mark or checking the XML prolog.
 void setCharset(java.lang.String charset)
          Sets the character set to use for the parsed document
 void setCompressionCodecs(CompressionUtil.CompressionCodec... codecs)
          When parsing an InputStream that contains compressed data, use these codecs to decompress the stream.
 void setFactory(Factory factory)
          Sets the factory the parser should use
 void setFilterRestrictedCharacterReplacement(char replacement)
          If getFilterRestrictedCharacters is true, restricted characters will be replaced with the specified character
 void setFilterRestrictedCharacters(boolean filter)
          If true, the parser will attempt to silently filter out invalid XML characters appearing within the XML document
 void setMustPreserveWhitespace(boolean preserve)
          If false, the parser will trim leading and trailing whitespace in element and attribute values unless there is an in-scope xml:space="preserve".
 void setParseFilter(ParseFilter parseFilter)
          Sets the Parse Filter.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected Factory factory

charset

protected java.lang.String charset

parseFilter

protected ParseFilter parseFilter

detect

protected boolean detect

preserve

protected boolean preserve

filterreserved

protected boolean filterreserved

replacement

protected char replacement

codecs

protected CompressionUtil.CompressionCodec[] codecs
Constructor Detail

AbstractParserOptions

public AbstractParserOptions()
Method Detail

initFactory

protected abstract void initFactory()

checkFactory

protected abstract void checkFactory(Factory factory)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface ParserOptions
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getFactory

public Factory getFactory()
Description copied from interface: ParserOptions
Returns the factory the parser should use

Specified by:
getFactory in interface ParserOptions

setFactory

public void setFactory(Factory factory)
Description copied from interface: ParserOptions
Sets the factory the parser should use

Specified by:
setFactory in interface ParserOptions

getCharset

public java.lang.String getCharset()
Description copied from interface: ParserOptions
Returns the default character set to use for the parsed document

Specified by:
getCharset in interface ParserOptions

setCharset

public void setCharset(java.lang.String charset)
Description copied from interface: ParserOptions
Sets the character set to use for the parsed document

Specified by:
setCharset in interface ParserOptions

getParseFilter

public ParseFilter getParseFilter()
Description copied from interface: ParserOptions
Returns the Parse Filter. The parse filter is a set of XML QNames that the parse should watch out for. If the filter is null, the parser will parse all elements in the document. I the filter is not null, the parser will only pay attention to elements whose QName's appear in the filter list.

Specified by:
getParseFilter in interface ParserOptions

setParseFilter

public void setParseFilter(ParseFilter parseFilter)
Description copied from interface: ParserOptions
Sets the Parse Filter. The parse filter is a set of XML QNames that the parse should watch out for. If the filter is null, the parser will parse all elements in the document. I the filter is not null, the parser will only pay attention to elements whose QName's appear in the filter list.

Specified by:
setParseFilter in interface ParserOptions

getAutodetectCharset

public boolean getAutodetectCharset()
Description copied from interface: ParserOptions
Returns true if the parser should attempt to automatically detect the character encoding from the stream

Specified by:
getAutodetectCharset in interface ParserOptions

setAutodetectCharset

public void setAutodetectCharset(boolean detect)
Description copied from interface: ParserOptions
If true, the parser will attempt to automatically detect the character encoding from the stream by checking for the byte order mark or checking the XML prolog.

Specified by:
setAutodetectCharset in interface ParserOptions

getMustPreserveWhitespace

public boolean getMustPreserveWhitespace()
Description copied from interface: ParserOptions
If false, the parser will trim leading and trailing whitespace in element and attribute values unless there is an in-scope xml:space="preserve".

Specified by:
getMustPreserveWhitespace in interface ParserOptions

setMustPreserveWhitespace

public void setMustPreserveWhitespace(boolean preserve)
Description copied from interface: ParserOptions
If false, the parser will trim leading and trailing whitespace in element and attribute values unless there is an in-scope xml:space="preserve".

Specified by:
setMustPreserveWhitespace in interface ParserOptions

getFilterRestrictedCharacters

public boolean getFilterRestrictedCharacters()
Description copied from interface: ParserOptions
If true, the parser will attempt to silently filter out invalid XML characters appearing within the XML document.

Specified by:
getFilterRestrictedCharacters in interface ParserOptions

setFilterRestrictedCharacters

public void setFilterRestrictedCharacters(boolean filter)
Description copied from interface: ParserOptions
If true, the parser will attempt to silently filter out invalid XML characters appearing within the XML document

Specified by:
setFilterRestrictedCharacters in interface ParserOptions

getFilterRestrictedCharacterReplacement

public char getFilterRestrictedCharacterReplacement()
Description copied from interface: ParserOptions
If getFilterRestrictedCharacters is true, restricted characters will be replaced with the specified character

Specified by:
getFilterRestrictedCharacterReplacement in interface ParserOptions

setFilterRestrictedCharacterReplacement

public void setFilterRestrictedCharacterReplacement(char replacement)
Description copied from interface: ParserOptions
If getFilterRestrictedCharacters is true, restricted characters will be replaced with the specified character

Specified by:
setFilterRestrictedCharacterReplacement in interface ParserOptions

getCompressionCodecs

public CompressionUtil.CompressionCodec[] getCompressionCodecs()
Description copied from interface: ParserOptions
When parsing an InputStream that contains compressed data, use these codecs to decompress the stream. Only used when parsing an InputStream. Ignored when parsing a Reader

Specified by:
getCompressionCodecs in interface ParserOptions

setCompressionCodecs

public void setCompressionCodecs(CompressionUtil.CompressionCodec... codecs)
Description copied from interface: ParserOptions
When parsing an InputStream that contains compressed data, use these codecs to decompress the stream. Only used when parsing an InputStream. Ignored when parsing a Reader

Specified by:
setCompressionCodecs in interface ParserOptions