org.eigenbase.xom.wrappers
Class GenericDOMParser

java.lang.Object
  extended by org.eigenbase.xom.wrappers.GenericDOMParser
All Implemented Interfaces:
Locator, Parser, ErrorHandler
Direct Known Subclasses:
JaxpDOMParser, XercesDOMParser

abstract class GenericDOMParser
extends Object
implements ErrorHandler, Parser, Locator

A GenericDOMParser is an abstract base class for XercesDOMParser and JaxpDOMParser.

Since:
Aug 29, 2002
Author:
jhyde
 

Field Summary
protected  Document document
          The document which spawns elements.
(package private)  StringWriter errorBuffer
           
(package private)  PrintWriter errorOut
           
(package private) static String LOAD_EXTERNAL_DTD_FEATURE
           
(package private) static String VALIDATION_FEATURE
           
 
Constructor Summary
GenericDOMParser()
           
 
Method Summary
 DOMWrapper create(String tagName)
          Creates a wrapper representing an XML element.
 void error(SAXParseException ex)
          Error.
 void fatalError(SAXParseException ex)
          Fatal error.
 Location getLocation(DOMWrapper wrapper)
           
protected  void handleErrors()
           
 boolean isKeepPositions()
          Returns whether the parser is retaining position information.
 DOMWrapper parse(InputStream is)
          Parses an input stream and returns a wrapped element.
 DOMWrapper parse(Reader reader)
          Parses the contents of a reader and returns a wrapped element.
 DOMWrapper parse(String xmlString)
          Parses a string and returns a wrapped element.
 DOMWrapper parse(URL url)
          Parses the contents of a URL and returns a wrapped element.
protected abstract  Document parseInputSource(InputSource in)
          Parses the specified URI and returns the document.
protected  void prepareParse()
           
 void setKeepPositions(boolean keepPositions)
          Sets whether to retain position information.
 void warning(SAXParseException ex)
          Warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorBuffer

StringWriter errorBuffer

errorOut

PrintWriter errorOut

document

protected Document document
The document which spawns elements. The constructor of the derived class must set this.


LOAD_EXTERNAL_DTD_FEATURE

static final String LOAD_EXTERNAL_DTD_FEATURE
See Also:
Constant Field Values

VALIDATION_FEATURE

static final String VALIDATION_FEATURE
See Also:
Constant Field Values
Constructor Detail

GenericDOMParser

GenericDOMParser()
Method Detail

create

public DOMWrapper create(String tagName)
Description copied from interface: Parser
Creates a wrapper representing an XML element.

Specified by:
create in interface Parser
Parameters:
tagName - Name of element
Returns:
Wrapper element

parse

public DOMWrapper parse(InputStream is)
                 throws XOMException
Description copied from interface: Parser
Parses an input stream and returns a wrapped element.

Specified by:
parse in interface Parser
Throws:
XOMException - on error
Parameters:
is - Input stream
Returns:
Wrapped element

setKeepPositions

public void setKeepPositions(boolean keepPositions)
Description copied from interface: Parser
Sets whether to retain position information.

Specified by:
setKeepPositions in interface Parser
Parameters:
keepPositions - Whether to keep position information.

isKeepPositions

public boolean isKeepPositions()
Description copied from interface: Parser
Returns whether the parser is retaining position information.

Specified by:
isKeepPositions in interface Parser
Returns:
Whether to keep position information.

parse

public DOMWrapper parse(String xmlString)
                 throws XOMException
Description copied from interface: Parser
Parses a string and returns a wrapped element.

Specified by:
parse in interface Parser
Throws:
XOMException - on error
Parameters:
xmlString - XML string
Returns:
Wrapped element

parse

public DOMWrapper parse(Reader reader)
                 throws XOMException
Description copied from interface: Parser
Parses the contents of a reader and returns a wrapped element.

Specified by:
parse in interface Parser
Throws:
XOMException - on error
Parameters:
reader - Reader
Returns:
Wrapped element

parseInputSource

protected abstract Document parseInputSource(InputSource in)
                                      throws XOMException
Parses the specified URI and returns the document.

Throws:
XOMException - on error
Parameters:
in - Input source
Returns:
Document

warning

public void warning(SAXParseException ex)
Warning.

Specified by:
warning in interface ErrorHandler

error

public void error(SAXParseException ex)
Error.

Specified by:
error in interface ErrorHandler

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
Fatal error.

Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException

parse

public DOMWrapper parse(URL url)
                 throws XOMException
Description copied from interface: Parser
Parses the contents of a URL and returns a wrapped element.

Specified by:
parse in interface Parser
Throws:
XOMException - on error
Parameters:
url - URL
Returns:
Wrapped element

prepareParse

protected void prepareParse()

handleErrors

protected void handleErrors()
                     throws XOMException
Throws:
XOMException

getLocation

public Location getLocation(DOMWrapper wrapper)
Specified by:
getLocation in interface Locator

SourceForge.net_Logo