public class SAXBuilderEngine extends java.lang.Object implements SAXEngine
InputSource instance using a SAX parser. This Engine is
built by the SAXBuilder based on the state of the SAXBuilder when the engine
was produced. It is not possible to reconfigure the engine once built, but it
can be reused many times (though not concurrently). This makes it the fastest
way to process many multitudes of XML documents (if those documents are all
parsed the same way). If you want to process in multiple threads you can
safely have one SAXBuilderEngine in each thread on the condition that:
XMLReaderJDOMFactory that it supplies a new
instance of an XMLReader on each call (the JDOM-supplied ones all do).
SAXHandlerFactory that it supplies a new
instance of a SAXHanfler on each call (the JDOM-supplied one does)
org.jdom2.input.sax| 构造器和说明 |
|---|
SAXBuilderEngine(org.xml.sax.XMLReader reader,
SAXHandler handler,
boolean validating)
Creates a new SAXBuilderEngine.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Document |
build(java.io.File file)
This builds a document from the supplied filename.
|
Document |
build(org.xml.sax.InputSource in)
This builds a document from the supplied input source.
|
Document |
build(java.io.InputStream in)
This builds a document from the supplied input stream.
|
Document |
build(java.io.InputStream in,
java.lang.String systemId)
This builds a document from the supplied input stream.
|
Document |
build(java.io.Reader characterStream)
This builds a document from the supplied Reader.
|
Document |
build(java.io.Reader characterStream,
java.lang.String systemId)
This builds a document from the supplied Reader.
|
Document |
build(java.lang.String systemId)
This builds a document from the supplied URI.
|
Document |
build(java.net.URL url)
This builds a document from the supplied URL.
|
org.xml.sax.DTDHandler |
getDTDHandler()
Returns the
DTDHandler assigned, or null if none. |
org.xml.sax.EntityResolver |
getEntityResolver()
Returns the
EntityResolver assigned, or null if none. |
org.xml.sax.ErrorHandler |
getErrorHandler()
Returns the
ErrorHandler assigned, or null if none. |
boolean |
getExpandEntities()
Returns whether or not entities are being expanded into normal text
content.
|
boolean |
getIgnoringBoundaryWhitespace()
Returns whether or not the parser will elminate element content
containing only whitespace.
|
boolean |
getIgnoringElementContentWhitespace()
Returns whether element content whitespace is to be ignored during the
build.
|
JDOMFactory |
getJDOMFactory()
Returns the current
JDOMFactory in use. |
boolean |
isValidating()
Returns whether validation is to be performed during the build.
|
public SAXBuilderEngine(org.xml.sax.XMLReader reader,
SAXHandler handler,
boolean validating)
reader - The XMLReader this Engine parses withhandler - The SAXHandler that processes the SAX Events.validating - True if this is a validating system.public JDOMFactory getJDOMFactory()
SAXEngineJDOMFactory in use.getJDOMFactory 在接口中 SAXEnginepublic boolean isValidating()
SAXEngineisValidating 在接口中 SAXEnginepublic org.xml.sax.ErrorHandler getErrorHandler()
SAXEngineErrorHandler assigned, or null if none.getErrorHandler 在接口中 SAXEnginepublic org.xml.sax.EntityResolver getEntityResolver()
SAXEngineEntityResolver assigned, or null if none.getEntityResolver 在接口中 SAXEnginepublic org.xml.sax.DTDHandler getDTDHandler()
SAXEngineDTDHandler assigned, or null if none.getDTDHandler 在接口中 SAXEnginepublic boolean getIgnoringElementContentWhitespace()
SAXEnginegetIgnoringElementContentWhitespace 在接口中 SAXEnginepublic boolean getIgnoringBoundaryWhitespace()
SAXEnginegetIgnoringBoundaryWhitespace 在接口中 SAXEngineboolean - whether only whitespace content will be
ignored during build.public boolean getExpandEntities()
SAXEnginegetExpandEntities 在接口中 SAXEnginepublic Document build(org.xml.sax.InputSource in) throws JDOMException, java.io.IOException
SAXEnginebuild 在接口中 SAXEnginein - InputSource to read fromDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsedpublic Document build(java.io.InputStream in) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied input stream.
build 在接口中 SAXEnginein - InputStream to read fromDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsed.public Document build(java.io.File file) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied filename.
build 在接口中 SAXEnginefile - File to read fromDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsedpublic Document build(java.net.URL url) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied URL.
build 在接口中 SAXEngineurl - URL to read from.Document - resultant Document object.JDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsed.public Document build(java.io.InputStream in, java.lang.String systemId) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied input stream.
build 在接口中 SAXEnginein - InputStream to read from.systemId - base for resolving relative URIsDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsedpublic Document build(java.io.Reader characterStream) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied Reader. It's the programmer's responsibility to make sure the reader matches the encoding of the file. It's often easier and safer to use an InputStream rather than a Reader, and to let the parser auto-detect the encoding from the XML declaration.
build 在接口中 SAXEnginecharacterStream - Reader to read fromDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsedpublic Document build(java.io.Reader characterStream, java.lang.String systemId) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied Reader. It's the programmer's responsibility to make sure the reader matches the encoding of the file. It's often easier and safer to use an InputStream rather than a Reader, and to let the parser auto-detect the encoding from the XML declaration.
build 在接口中 SAXEnginecharacterStream - Reader to read from.systemId - base for resolving relative URIsDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsedpublic Document build(java.lang.String systemId) throws JDOMException, java.io.IOException
SAXEngineThis builds a document from the supplied URI.
build 在接口中 SAXEnginesystemId - URI for the inputDocument resultant Document objectJDOMException - when errors occur in parsingjava.io.IOException - when an I/O error prevents a document from being fully parsed