org.apache.abdera.util
Class AbstractParser

java.lang.Object
  extended by org.apache.abdera.util.AbstractParser
All Implemented Interfaces:
Parser
Direct Known Subclasses:
AbstractNamedParser, FOMParser

public abstract class AbstractParser
extends Object
implements Parser

Abstract base implementation of Abdera Parser.


Field Summary
protected  Abdera abdera
           
protected  ParserOptions options
           
 
Constructor Summary
protected AbstractParser()
           
protected AbstractParser(Abdera abdera)
           
 
Method Summary
 Abdera getAbdera()
           
 ParserOptions getDefaultParserOptions()
          Return the default parser options for this Parser.
 Factory getFactory()
           
protected abstract  ParserOptions initDefaultParserOptions()
           
<T extends Element>
Document<T>
parse(InputStream in)
          Parse the input stream using the default character set encoding (UTF-8)
<T extends Element>
Document<T>
parse(InputStream in, ParserOptions options)
          Parse the input stream using the default character set encoding (UTF-8).
<T extends Element>
Document<T>
parse(InputStream in, String base)
          Parse the input stream using the default character set encoding (UTF-8).
<T extends Element>
Document<T>
parse(InputStream in, String base, ParserOptions options)
          Parse the input stream using using the specified Parse options.
<T extends Element>
Document<T>
parse(ReadableByteChannel buf)
          Parse the channel using using the specified Parse options.
<T extends Element>
Document<T>
parse(ReadableByteChannel buf, ParserOptions options)
          Parse the channel using using the specified Parse options.
<T extends Element>
Document<T>
parse(ReadableByteChannel buf, String base)
          Parse the channel using using the specified Parse options.
<T extends Element>
Document<T>
parse(ReadableByteChannel buf, String base, ParserOptions options)
          Parse the channel using using the specified Parse options.
<T extends Element>
Document<T>
parse(Reader in)
          Parse the reader using the default Base URI and options
<T extends Element>
Document<T>
parse(Reader in, ParserOptions options)
          Parse the reader using the specified Base URI
<T extends Element>
Document<T>
parse(Reader in, String base)
          Parse the reader using the specified Base URI
<T extends Element>
Document<T>
parse(javax.xml.stream.XMLStreamReader reader)
          Parse the input stream using the default character set encoding (UTF-8)
 void setAbdera(Abdera abdera)
           
 Parser setDefaultParserOptions(ParserOptions options)
          Set the default parser options for this Parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.abdera.parser.Parser
parse, parse
 

Field Detail

abdera

protected Abdera abdera

options

protected ParserOptions options
Constructor Detail

AbstractParser

protected AbstractParser()

AbstractParser

protected AbstractParser(Abdera abdera)
Method Detail

getAbdera

public Abdera getAbdera()

setAbdera

public void setAbdera(Abdera abdera)

getFactory

public Factory getFactory()

parse

public <T extends Element> Document<T> parse(InputStream in)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using the default character set encoding (UTF-8)

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(javax.xml.stream.XMLStreamReader reader)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using the default character set encoding (UTF-8)

Specified by:
parse in interface Parser
Parameters:
reader - The XMLStreamReader to use to parse
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(InputStream in,
                                             String base)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using the default character set encoding (UTF-8). The specified Base URI is used to resolve relative references contained in the document

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
base - The Base URI of the document
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(InputStream in,
                                             ParserOptions options)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using the default character set encoding (UTF-8). The specified Base URI is used to resolve relative references contained in the document

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
options - The Parse options
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(InputStream in,
                                             String base,
                                             ParserOptions options)
                                  throws ParseException
Description copied from interface: Parser
Parse the input stream using using the specified Parse options. The parse options can be used to control various aspects of the parsing process such as the character set encoding to use and whether certain elements should be ignored. The specified Base URI is used to resolve relative references contained in the document.

Specified by:
parse in interface Parser
Parameters:
in - The input stream to parse
base - The Base URI of the document
options - The Parse Options
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(Reader in)
                                  throws ParseException
Description copied from interface: Parser
Parse the reader using the default Base URI and options

Specified by:
parse in interface Parser
Parameters:
in - The Reader to parse
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(Reader in,
                                             String base)
                                  throws ParseException
Description copied from interface: Parser
Parse the reader using the specified Base URI

Specified by:
parse in interface Parser
Parameters:
in - The Reader to parse
base - The Base URI
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(Reader in,
                                             ParserOptions options)
                                  throws ParseException
Description copied from interface: Parser
Parse the reader using the specified Base URI

Specified by:
parse in interface Parser
Parameters:
in - The Reader to parse
options - The Parse Options
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(ReadableByteChannel buf,
                                             ParserOptions options)
                                  throws ParseException
Description copied from interface: Parser
Parse the channel using using the specified Parse options. The parse options can be used to control various aspects of the parsing process such as the character set encoding to use and whether certain elements should be ignored. The specified Base URI is used to resolve relative references contained in the document.

Specified by:
parse in interface Parser
options - The Parse Options
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(ReadableByteChannel buf,
                                             String base,
                                             ParserOptions options)
                                  throws ParseException
Description copied from interface: Parser
Parse the channel using using the specified Parse options. The parse options can be used to control various aspects of the parsing process such as the character set encoding to use and whether certain elements should be ignored. The specified Base URI is used to resolve relative references contained in the document.

Specified by:
parse in interface Parser
base - The Base URI of the document
options - The Parse Options
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(ReadableByteChannel buf,
                                             String base)
                                  throws ParseException
Description copied from interface: Parser
Parse the channel using using the specified Parse options. The parse options can be used to control various aspects of the parsing process such as the character set encoding to use and whether certain elements should be ignored. The specified Base URI is used to resolve relative references contained in the document.

Specified by:
parse in interface Parser
base - The Base URI of the document
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

parse

public <T extends Element> Document<T> parse(ReadableByteChannel buf)
                                  throws ParseException
Description copied from interface: Parser
Parse the channel using using the specified Parse options. The parse options can be used to control various aspects of the parsing process such as the character set encoding to use and whether certain elements should be ignored. The specified Base URI is used to resolve relative references contained in the document.

Specified by:
parse in interface Parser
Returns:
The parsed Abdera Document
Throws:
ParseException - if the parse failed

getDefaultParserOptions

public ParserOptions getDefaultParserOptions()
Description copied from interface: Parser
Return the default parser options for this Parser. This method returns a copy of the default options. Changes to this instance will not affect the defaults returned by subsequent requests.

Specified by:
getDefaultParserOptions in interface Parser
Returns:
The default ParserOptions

initDefaultParserOptions

protected abstract ParserOptions initDefaultParserOptions()

setDefaultParserOptions

public Parser setDefaultParserOptions(ParserOptions options)
Description copied from interface: Parser
Set the default parser options for this Parser. This method copies the specified options.

Specified by:
setDefaultParserOptions in interface Parser
Parameters:
options - The Parser Options to use as the default


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.