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
public DOMWrapper create(String tagName)
Parserpublic DOMWrapper parse(InputStream is) throws XOMException
Parserparse in interface Parseris - Input streamXOMException - on errorpublic void setKeepPositions(boolean keepPositions)
ParsersetKeepPositions in interface ParserkeepPositions - Whether to keep position information.public boolean isKeepPositions()
ParserisKeepPositions in interface Parserpublic DOMWrapper parse(String xmlString) throws XOMException
Parserparse in interface ParserxmlString - XML stringXOMException - on errorpublic DOMWrapper parse(Reader reader) throws XOMException
Parserparse in interface Parserreader - ReaderXOMException - on errorprotected abstract Document parseInputSource(InputSource in) throws XOMException
in - Input sourceXOMException - on errorpublic void warning(SAXParseException ex)
warning in interface ErrorHandlerpublic void error(SAXParseException ex)
error in interface ErrorHandlerpublic void fatalError(SAXParseException ex) throws SAXException
fatalError in interface ErrorHandlerSAXExceptionpublic DOMWrapper parse(URL url) throws XOMException
Parserparse in interface Parserurl - URLXOMException - on errorprotected void prepareParse()
protected void handleErrors()
throws XOMException
XOMExceptionpublic Location getLocation(DOMWrapper wrapper)
getLocation in interface Locator