public class ActiveSAXSource extends javax.xml.transform.sax.SAXSource implements ActiveSource
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).
Constructor and Description |
---|
ActiveSAXSource(org.xml.sax.InputSource inputSource,
Configuration config) |
ActiveSAXSource(javax.xml.transform.sax.SAXSource source)
Construct an ActiveSAXSource from a SAXSource
|
ActiveSAXSource(org.xml.sax.XMLReader parser,
org.xml.sax.InputSource source) |
Modifier and Type | Method and Description |
---|---|
static void |
configureParser(org.xml.sax.XMLReader parser)
Configure a SAX parser to ensure it has the correct namespace properties set
|
void |
deliver(Receiver receiver,
ParseOptions options)
Deliver the content of the source to a supplied Receiver.
|
void |
setParserPool(java.util.function.Consumer<org.xml.sax.XMLReader> parserPool)
Supply a mechanism to recycle the XMLReader after use
|
getInputSource, getSystemId, getXMLReader, setInputSource, setSystemId, setXMLReader, sourceToInputSource
public ActiveSAXSource(org.xml.sax.XMLReader parser, org.xml.sax.InputSource source)
public ActiveSAXSource(javax.xml.transform.sax.SAXSource source) throws java.lang.IllegalArgumentException, XPathException
source
- the input source object, whose properties are copied. The source must
include a non-null XMLReader.java.lang.IllegalArgumentException
XPathException
public ActiveSAXSource(org.xml.sax.InputSource inputSource, Configuration config)
public void setParserPool(java.util.function.Consumer<org.xml.sax.XMLReader> parserPool)
parserPool
- a place to return the parser after parsing is completepublic void deliver(Receiver receiver, ParseOptions options) throws XPathException
ActiveSource
For many (but not all) implementations of Source
, this method consumes
the source and can therefore only be called once.
deliver
in interface ActiveSource
receiver
- the receiver to which events representing the parsed XML document will be sentoptions
- options for parsing the sourceXPathException
- if parsing fails for any reason. The detailed diagnostics will
have been sent to the error reporter.public static void configureParser(org.xml.sax.XMLReader parser) throws XPathException
parser
- the parser to be configuredXPathException
- 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.Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.