public class QueryReader
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
readEncoding(java.io.InputStream is)
Read an input stream non-destructively to determine the encoding from the Query Prolog
|
static java.lang.String |
readInputStream(java.io.InputStream is,
java.lang.String encoding,
java.util.function.IntPredicate nameChecker)
Read a query from an InputStream.
|
static java.lang.String |
readSourceQuery(javax.xml.transform.stream.StreamSource ss,
java.util.function.IntPredicate charChecker)
Read a query module given a StreamSource
|
public static java.lang.String readSourceQuery(javax.xml.transform.stream.StreamSource ss, java.util.function.IntPredicate charChecker) throws XPathException
ss
- the supplied StreamSource. This must contain a non-null systemID which defines the base
URI of the query module, and either an InputStream or a Reader containing the query text. In the
case of an InputStream the method attempts to infer the encoding; in the case of a Reader, this has
already been done, and the encoding specified within the query itself is ignored.
The method reads from the InputStream or Reader contained in the StreamSource up to the end of file unless a fatal error occurs. It does not close the InputStream or Reader; this is the caller's responsibility.
charChecker
- this checks XML characters against either the XML 1.0 or XML 1.1 rulesXPathException
public static java.lang.String readEncoding(java.io.InputStream is) throws XPathException
is
- the input stream: this must satisfy the precondition is.markSupported() = true.XPathException
- if the input stream cannot be readpublic static java.lang.String readInputStream(java.io.InputStream is, java.lang.String encoding, java.util.function.IntPredicate nameChecker) throws XPathException
is
- the input streamencoding
- the encoding, or null if the encoding is unknownnameChecker
- the predicate to be used for checking charactersXPathException
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.