|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.Query
public class Query
This Query class provides a command-line interface to the Saxon XQuery processor.
The XQuery syntax supported conforms to the W3C XQuery 1.0 drafts.
Field Summary | |
---|---|
protected boolean |
backup
|
protected Configuration |
config
|
protected boolean |
explain
|
protected String |
explainOutputFileName
|
protected String |
languageVersion
|
protected String |
moduleURIResolverClass
|
protected String |
outputFileName
|
protected Properties |
outputProperties
|
protected boolean |
projection
|
protected boolean |
pullMode
|
protected String |
queryFileName
|
protected int |
repeat
|
protected boolean |
showTime
|
protected String |
sourceFileName
|
protected boolean |
updating
|
protected String |
uriResolverClass
|
protected boolean |
useURLs
|
protected boolean |
wrap
|
protected boolean |
writeback
|
Constructor Summary | |
---|---|
Query()
|
Method Summary | |
---|---|
protected void |
badUsage(String name,
String message)
Report incorrect usage of the command line, with a list of the options and arguments that are available |
protected XQueryExpression |
compileQuery(StaticQueryContext staticEnv,
String queryFileName,
boolean useURLs)
Compile the query |
protected void |
doQuery(String[] args,
String command)
Support method for main program. |
protected void |
explain(XQueryExpression exp)
Explain the results of query compilation |
protected Configuration |
getConfiguration()
Get the configuration in use |
protected static void |
loadAdditionalSchemas(Configuration config,
String additionalSchemas)
|
static void |
main(String[] args)
Main program, can be used directly from the command line. |
protected void |
parseOptions(String[] args,
String command,
StaticQueryContext staticEnv,
DynamicQueryContext dynamicEnv)
Parse the options supplied on the command line |
protected void |
processSource(Source sourceInput,
XQueryExpression exp,
DynamicQueryContext dynamicEnv)
Process the supplied source file |
protected Source |
processSourceFile(String sourceFileName,
boolean useURLs)
|
protected static void |
quit(String message,
int code)
Exit with a message |
protected void |
runQuery(XQueryExpression exp,
DynamicQueryContext dynamicEnv,
OutputStream destination,
Properties outputProps)
Run the query |
protected boolean |
testIfSchemaAware(String[] args)
Prescan the command line arguments to see if any of them imply use of a schema-aware processor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Configuration config
protected Properties outputProperties
protected boolean showTime
protected int repeat
protected String sourceFileName
protected String queryFileName
protected boolean useURLs
protected String outputFileName
protected String moduleURIResolverClass
protected String uriResolverClass
protected boolean explain
protected boolean wrap
protected boolean pullMode
protected boolean projection
protected String languageVersion
protected boolean updating
protected boolean writeback
protected boolean backup
protected String explainOutputFileName
Constructor Detail |
---|
public Query()
Method Detail |
---|
protected Configuration getConfiguration()
public static void main(String[] args) throws Exception
The format is:
java net.sf.saxon.Query [options] query-file >output-file
followed by any number of parameters in the form {keyword=value}... which can be referenced from within the query.
This program executes the query in query-file.
args
- List of arguments supplied on operating system command line
Exception
- Indicates that a compile-time or
run-time error occurredprotected void doQuery(String[] args, String command)
args
- the command-line argumentscommand
- name of the class, to be used in error messagesprotected boolean testIfSchemaAware(String[] args)
args
- the command line arguments
protected void parseOptions(String[] args, String command, StaticQueryContext staticEnv, DynamicQueryContext dynamicEnv) throws TransformerException
args
- the command line argumentscommand
- the name of the command that was used (for diagnostics only)dynamicEnv
- the XQuery dynamic context
TransformerException
- if failures occur. Note, the method may also invoke System.exit().protected static void loadAdditionalSchemas(Configuration config, String additionalSchemas) throws TransformerException
TransformerException
protected Source processSourceFile(String sourceFileName, boolean useURLs) throws TransformerException
TransformerException
protected XQueryExpression compileQuery(StaticQueryContext staticEnv, String queryFileName, boolean useURLs) throws XPathException, IOException
staticEnv
- the static query contextqueryFileName
- the filename holding the query (or "-" for the standard input)useURLs
- true if the filename is in the form of a URI
XPathException
- if query compilation fails
IOException
- if the query cannot be readprotected void explain(XQueryExpression exp) throws FileNotFoundException, XPathException
exp
- the compiled expression
FileNotFoundException
- if the destination for the explanation doesn't exist
XPathException
- if other failures occurprotected void processSource(Source sourceInput, XQueryExpression exp, DynamicQueryContext dynamicEnv) throws XPathException
sourceInput
- the supplied sourceexp
- the compiled XQuery expressiondynamicEnv
- the dynamic query context
XPathException
- if processing failsprotected void runQuery(XQueryExpression exp, DynamicQueryContext dynamicEnv, OutputStream destination, Properties outputProps) throws XPathException, IOException
exp
- the compiled query expressiondynamicEnv
- the dynamic query contextdestination
- the destination for serialized resultsoutputProps
- serialization properties defining the output format
XPathException
- if the query fails
IOException
- if input or output failsprotected static void quit(String message, int code)
message
- The message to be outputcode
- The result code to be returned to the operating
system shellprotected void badUsage(String name, String message)
name
- The name of the command being executed (allows subclassing)message
- The error message
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |