Package net.sf.saxon.resource
Class ActiveSAXSource
java.lang.Object
javax.xml.transform.sax.SAXSource
net.sf.saxon.resource.ActiveSAXSource
- All Implemented Interfaces:
Source
,ActiveSource
This class extends the standard SAXSource class by providing a
deliver(Receiver, ParseOptions)
method, meaning that Saxon can treat it just like any other ActiveSource
implementation.
This makes it easier to extract code from the product that's specific to the Java platform (in particular, support for SAX APIs).
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionActiveSAXSource
(SAXSource source) Construct an ActiveSAXSource from a SAXSourceActiveSAXSource
(InputSource inputSource, Configuration config) ActiveSAXSource
(XMLReader parser, InputSource source) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
configureParser
(XMLReader parser) Configure a SAX parser to ensure it has the correct namespace properties setvoid
deliver
(Receiver receiver, ParseOptions options) Deliver the content of the source to a supplied Receiver.void
setParserPool
(Consumer<XMLReader> parserPool) Supply a mechanism to recycle the XMLReader after useMethods inherited from class javax.xml.transform.sax.SAXSource
getInputSource, getSystemId, getXMLReader, isEmpty, setInputSource, setSystemId, setXMLReader, sourceToInputSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.xml.transform.Source
getSystemId, isEmpty, setSystemId
-
Constructor Details
-
ActiveSAXSource
-
ActiveSAXSource
Construct an ActiveSAXSource from a SAXSource- Parameters:
source
- the input source object, whose properties are copied. The source must include a non-null XMLReader.- Throws:
IllegalArgumentException
XPathException
-
ActiveSAXSource
-
-
Method Details
-
setParserPool
Supply a mechanism to recycle the XMLReader after use- Parameters:
parserPool
- a place to return the parser after parsing is complete
-
deliver
Description copied from interface:ActiveSource
Deliver the content of the source to a supplied Receiver.For many (but not all) implementations of
Source
, this method consumes the source and can therefore only be called once.- Specified by:
deliver
in interfaceActiveSource
- Parameters:
receiver
- the receiver to which events representing the parsed XML document will be sentoptions
- options for parsing the source- Throws:
XPathException
- if parsing fails for any reason. The detailed diagnostics will have been sent to the error reporter.
-
configureParser
Configure a SAX parser to ensure it has the correct namespace properties set- Parameters:
parser
- the parser to be configured- Throws:
XPathException
- if the parser cannot be configured to the required settings (namespaces=true, namespace-prefixes=false). Note that the SAX specification requires every XMLReader to support these settings, so this error implies that the XMLReader is non-conformant; this is not uncommon in cases where the XMLReader is user-written.
-