Package org.eigenbase.xom.wrappers
Class GenericDOMParser
- java.lang.Object
-
- org.eigenbase.xom.wrappers.GenericDOMParser
-
- Direct Known Subclasses:
JaxpDOMParser,XercesDOMParser
abstract class GenericDOMParser extends java.lang.Object implements org.xml.sax.ErrorHandler, Parser, Locator
- Since:
- Aug 29, 2002
- Version:
- $Id: //open/util/resgen/src/org/eigenbase/xom/wrappers/GenericDOMParser.java#6 $
- Author:
- jhyde
-
-
Field Summary
Fields Modifier and Type Field Description protected org.w3c.dom.DocumentdocumentThe document which spawns elements.(package private) java.io.StringWritererrorBuffer(package private) java.io.PrintWritererrorOut(package private) static java.lang.StringLOAD_EXTERNAL_DTD_FEATURE(package private) static java.lang.StringVALIDATION_FEATURE
-
Constructor Summary
Constructors Constructor Description GenericDOMParser()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DOMWrappercreate(java.lang.String tagName)Creates a wrapper representing an XML element.voiderror(org.xml.sax.SAXParseException ex)Error.voidfatalError(org.xml.sax.SAXParseException ex)Fatal error.LocationgetLocation(DOMWrapper wrapper)protected voidhandleErrors()booleanisKeepPositions()Returns whether the parser is retaining position information.DOMWrapperparse(java.io.InputStream is)Parses an input stream and returns a wrapped element.DOMWrapperparse(java.io.Reader reader)Parses the contents of a reader and returns a wrapped element.DOMWrapperparse(java.lang.String xmlString)Parses a string and returns a wrapped element.DOMWrapperparse(java.net.URL url)Parses the contents of a URL and returns a wrapped element.protected abstract org.w3c.dom.DocumentparseInputSource(org.xml.sax.InputSource in)Parses the specified URI and returns the document.protected voidprepareParse()voidsetKeepPositions(boolean keepPositions)Sets whether to retain position information.voidwarning(org.xml.sax.SAXParseException ex)Warning.
-
-
-
Field Detail
-
errorBuffer
java.io.StringWriter errorBuffer
-
errorOut
java.io.PrintWriter errorOut
-
document
protected org.w3c.dom.Document document
The document which spawns elements. The constructor of the derived class must set this.
-
LOAD_EXTERNAL_DTD_FEATURE
static final java.lang.String LOAD_EXTERNAL_DTD_FEATURE
- See Also:
- Constant Field Values
-
VALIDATION_FEATURE
static final java.lang.String VALIDATION_FEATURE
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public DOMWrapper create(java.lang.String tagName)
Description copied from interface:ParserCreates a wrapper representing an XML element.
-
parse
public DOMWrapper parse(java.io.InputStream is) throws XOMException
Description copied from interface:ParserParses an input stream and returns a wrapped element.- Specified by:
parsein interfaceParser- Parameters:
is- Input stream- Returns:
- Wrapped element
- Throws:
XOMException- on error
-
setKeepPositions
public void setKeepPositions(boolean keepPositions)
Description copied from interface:ParserSets whether to retain position information.- Specified by:
setKeepPositionsin interfaceParser- Parameters:
keepPositions- Whether to keep position information.
-
isKeepPositions
public boolean isKeepPositions()
Description copied from interface:ParserReturns whether the parser is retaining position information.- Specified by:
isKeepPositionsin interfaceParser- Returns:
- Whether to keep position information.
-
parse
public DOMWrapper parse(java.lang.String xmlString) throws XOMException
Description copied from interface:ParserParses a string and returns a wrapped element.- Specified by:
parsein interfaceParser- Parameters:
xmlString- XML string- Returns:
- Wrapped element
- Throws:
XOMException- on error
-
parse
public DOMWrapper parse(java.io.Reader reader) throws XOMException
Description copied from interface:ParserParses the contents of a reader and returns a wrapped element.- Specified by:
parsein interfaceParser- Parameters:
reader- Reader- Returns:
- Wrapped element
- Throws:
XOMException- on error
-
parseInputSource
protected abstract org.w3c.dom.Document parseInputSource(org.xml.sax.InputSource in) throws XOMExceptionParses the specified URI and returns the document.- Parameters:
in- Input source- Returns:
- Document
- Throws:
XOMException- on error
-
warning
public void warning(org.xml.sax.SAXParseException ex)
Warning.- Specified by:
warningin interfaceorg.xml.sax.ErrorHandler
-
error
public void error(org.xml.sax.SAXParseException ex)
Error.- Specified by:
errorin interfaceorg.xml.sax.ErrorHandler
-
fatalError
public void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXExceptionFatal error.- Specified by:
fatalErrorin interfaceorg.xml.sax.ErrorHandler- Throws:
org.xml.sax.SAXException
-
parse
public DOMWrapper parse(java.net.URL url) throws XOMException
Description copied from interface:ParserParses the contents of a URL and returns a wrapped element.- Specified by:
parsein interfaceParser- Parameters:
url- URL- Returns:
- Wrapped element
- Throws:
XOMException- on error
-
prepareParse
protected void prepareParse()
-
handleErrors
protected void handleErrors() throws XOMException- Throws:
XOMException
-
getLocation
public Location getLocation(DOMWrapper wrapper)
- Specified by:
getLocationin interfaceLocator
-
-