Class ActiveSAXSource

  • All Implemented Interfaces:
    Source, ActiveSource

    public class ActiveSAXSource
    extends SAXSource
    implements 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).

    • Method Detail

      • setParserPool

        public void setParserPool​(Consumer<XMLReader> parserPool)
        Supply a mechanism to recycle the XMLReader after use
        Parameters:
        parserPool - a place to return the parser after parsing is complete
      • deliver

        public void deliver​(Receiver receiver,
                            ParseOptions options)
                     throws XPathException
        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 interface ActiveSource
        Parameters:
        receiver - the receiver to which events representing the parsed XML document will be sent
        options - 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

        public static void configureParser​(XMLReader parser)
                                    throws XPathException
        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.