org.eigenbase.xom.wrappers
abstract class GenericDOMParser extends Object implements ErrorHandler, Parser, Locator
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
GenericDOMParser() |
Modifier and Type | Method and Description |
---|---|
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.
|
StringWriter errorBuffer
PrintWriter errorOut
protected Document document
static final String LOAD_EXTERNAL_DTD_FEATURE
static final String VALIDATION_FEATURE
GenericDOMParser()
public DOMWrapper create(String tagName)
Parser
public DOMWrapper parse(InputStream is) throws XOMException
Parser
parse
in interface Parser
is
- Input streamXOMException
- on errorpublic void setKeepPositions(boolean keepPositions)
Parser
setKeepPositions
in interface Parser
keepPositions
- Whether to keep position information.public boolean isKeepPositions()
Parser
isKeepPositions
in interface Parser
public DOMWrapper parse(String xmlString) throws XOMException
Parser
parse
in interface Parser
xmlString
- XML stringXOMException
- on errorpublic DOMWrapper parse(Reader reader) throws XOMException
Parser
parse
in interface Parser
reader
- ReaderXOMException
- on errorprotected abstract Document parseInputSource(InputSource in) throws XOMException
in
- Input sourceXOMException
- on errorpublic void warning(SAXParseException ex)
warning
in interface ErrorHandler
public void error(SAXParseException ex)
error
in interface ErrorHandler
public void fatalError(SAXParseException ex) throws SAXException
fatalError
in interface ErrorHandler
SAXException
public DOMWrapper parse(URL url) throws XOMException
Parser
parse
in interface Parser
url
- URLXOMException
- on errorprotected void prepareParse()
protected void handleErrors() throws XOMException
XOMException
public Location getLocation(DOMWrapper wrapper)
getLocation
in interface Locator