Package org.apache.xml.dtm.ref
Class IncrementalSAXSource_Xerces
java.lang.Object
org.apache.xml.dtm.ref.IncrementalSAXSource_Xerces
- All Implemented Interfaces:
IncrementalSAXSource
IncrementalSAXSource_Xerces takes advantage of the fact that Xerces1 incremental mode is already a coroutine of sorts, and just wraps our IncrementalSAXSource API around it.
Usage example: See main().
Status: Passes simple main() unit-test. NEEDS JAVADOC.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a IncrementalSAXSource_Xerces, and create a SAXParser to go with it.IncrementalSAXSource_Xerces
(org.apache.xerces.parsers.SAXParser parser) Create a IncrementalSAXSource_Xerces wrapped around an existing SAXParser. -
Method Summary
Modifier and TypeMethodDescriptionstatic IncrementalSAXSource
static IncrementalSAXSource
createIncrementalSAXSource
(org.apache.xerces.parsers.SAXParser parser) deliverMoreNodes
(boolean parsemore) deliverMoreNodes() is a simple API which tells the coroutine parser that we need more nodes.static void
Simple unit test.void
setContentHandler
(ContentHandler handler) Register a SAX-style content handler for us to output tovoid
setDTDHandler
(DTDHandler handler) Register a SAX-style DTD handler for us to output tovoid
setLexicalHandler
(LexicalHandler handler) Register a SAX-style lexical handler for us to output tovoid
startParse
(InputSource source) startParse() is a simple API which tells the IncrementalSAXSource to begin reading a document.
-
Constructor Details
-
IncrementalSAXSource_Xerces
Create a IncrementalSAXSource_Xerces, and create a SAXParser to go with it. Xerces2 incremental parsing is only supported if this constructor is used, due to limitations in the Xerces2 API (as of Beta 3). If you don't like that restriction, tell the Xerces folks that there should be a simpler way to request incremental SAX parsing.- Throws:
NoSuchMethodException
-
IncrementalSAXSource_Xerces
public IncrementalSAXSource_Xerces(org.apache.xerces.parsers.SAXParser parser) throws NoSuchMethodException Create a IncrementalSAXSource_Xerces wrapped around an existing SAXParser. Currently this works only for recent releases of Xerces-1. Xerces-2 incremental is currently possible only if we are allowed to create the parser instance, due to limitations in the API exposed by Xerces-2 Beta 3; see the no-args constructor for that code.- Throws:
NoSuchMethodException
-
-
Method Details
-
createIncrementalSAXSource
-
createIncrementalSAXSource
public static IncrementalSAXSource createIncrementalSAXSource(org.apache.xerces.parsers.SAXParser parser) -
setContentHandler
Description copied from interface:IncrementalSAXSource
Register a SAX-style content handler for us to output to- Specified by:
setContentHandler
in interfaceIncrementalSAXSource
-
setLexicalHandler
Description copied from interface:IncrementalSAXSource
Register a SAX-style lexical handler for us to output to- Specified by:
setLexicalHandler
in interfaceIncrementalSAXSource
-
setDTDHandler
Description copied from interface:IncrementalSAXSource
Register a SAX-style DTD handler for us to output to- Specified by:
setDTDHandler
in interfaceIncrementalSAXSource
-
startParse
startParse() is a simple API which tells the IncrementalSAXSource to begin reading a document.- Specified by:
startParse
in interfaceIncrementalSAXSource
- Throws:
SAXException
- is parse thread is already in progress or parsing can not be started.
-
deliverMoreNodes
deliverMoreNodes() is a simple API which tells the coroutine parser that we need more nodes. This is intended to be called from one of our partner routines, and serves to encapsulate the details of how incremental parsing has been achieved.- Specified by:
deliverMoreNodes
in interfaceIncrementalSAXSource
- Parameters:
parsemore
- If true, tells the incremental parser to generate another chunk of output. If false, tells the parser that we're satisfied and it can terminate parsing of this document.- Returns:
- Boolean.TRUE if the CoroutineParser believes more data may be available for further parsing. Boolean.FALSE if parsing ran to completion. Exception if the parser objected for some reason.
-
main
Simple unit test. Attempt coroutine parsing of document indicated by first argument (as a URI), report progress.
-