本文整理了Java中net.sf.saxon.Query
类的一些代码示例,展示了Query
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query
类的具体详情如下:
包路径:net.sf.saxon.Query
类名称: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.
[中]这个查询类为Saxon XQuery处理器提供了一个命令行接口。
支持的XQuery语法符合W3C XQuery 1.0草案。
代码示例来源:origin: stackoverflow.com
public Cursor query(Query query) {
Cursor underlyingCursor = query.runQuery(mResolver, UNDERLYING_COLUMNS, mBaseUri);
if (underlyingCursor == null) {
return null;
}
return new CursorTranslator(underlyingCursor, mBaseUri);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Main program, can be used directly from the command line.
* <p>The format is:</p>
* <p>java net.sf.saxon.Query [options] <i>query-file</i> ><i>output-file</i></p>
* <p>followed by any number of parameters in the form {keyword=value}... which can be
* referenced from within the query.</p>
* <p>This program executes the query in query-file.</p>
*
* @param args List of arguments supplied on operating system command line
*/
public static void main(String args[]) {
// the real work is delegated to another routine so that it can be used in a subclass
new Query().doQuery(args, "java net.sf.saxon.Query");
}
代码示例来源:origin: net.sourceforge.saxon/saxon
schemaAware = testIfSchemaAware(args);
config = makeConfiguration(schemaAware, null);
config.setHostLanguage(Configuration.XQUERY);
parseOptions(args, command, dynamicEnv, outputProps);
Object mr = config.getInstance(moduleURIResolverClass, null);
if (!(mr instanceof ModuleURIResolver)) {
badUsage(command, moduleURIResolverClass + " is not a ModuleURIResolver");
sourceInput = processSourceFile(sourceFileName, useURLs);
exp = compileQuery(staticEnv, queryFileName, useURLs);
quit("Static error(s) in query", 2);
} else {
if (line == -1) {
explain(exp);
processSource(sourceInput, exp, dynamicEnv);
File outputFile = new File(outputFileName);
if (outputFile.isDirectory()) {
quit("Output is a directory", 2);
runQuery(exp, dynamicEnv, destination, outputProps);
} catch (TerminationException err) {
代码示例来源:origin: net.sf.saxon/Saxon-HE
setPermittedOptions(options);
try {
options.setActualOptions(args);
} catch (XPathException err) {
quit(err.getMessage(), 2);
schemaAware = config.isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY);
} catch (XPathException e) {
quit(e.getMessage(), 2);
parseOptions(options);
Object mr = config.getInstance(moduleURIResolverClass, null);
if (!(mr instanceof ModuleURIResolver)) {
badUsage(moduleURIResolverClass + " is not a ModuleURIResolver");
if (schemaAware && !config.isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY)) {
if ("EE".equals(config.getEditionCode())) {
quit("Installed license does not allow schema-aware query", 2);
} else {
quit("Schema-aware query requires Saxon Enterprise Edition", 2);
sourceInput = processSourceFile(sourceFileName, useURLs);
exp = compileQuery(compiler, queryFileName, useURLs);
quit("Static error(s) in query", 2);
} else {
if (line == -1) {
代码示例来源:origin: net.sf.saxon/Saxon-HE
closeTraceDestination = true;
} catch (FileNotFoundException e) {
badUsage("Trace output file " + value + " cannot be created");
if (value != null) {
if ("".equals(value)) {
makeXQueryTraceListener(options);
} else {
config.setTraceListenerClass(value);
config.setTraceListenerOutputFile(value);
if (options.getOptionValue("T") == null) {
makeXQueryTraceListener(options);
new StandardLogger(new File(value)));
} catch (FileNotFoundException e) {
badUsage("Trace output file " + value + " cannot be created");
badUsage("");
applyLocalOptions(options, config);
badUsage("No query file name");
badUsage("Unrecognized option: " + positional.get(currentPositionalOption));
代码示例来源:origin: net.sourceforge.saxon/saxon
badUsage(command, "-backup option must be -backup:on or -backup:off");
if (value == null) {
if (args.length < i + 2) {
badUsage(command, "No resolver after -cr");
quit(value + " is not a CollectionURIResolver", 2);
} else if (option.equals("dtd")) {
if (!("on".equals(value) || "off".equals(value))) {
badUsage(command, "-dtd option must be -dtd:on or -dtd:off");
} else if (option.equals("expand")) {
if (!("on".equals(value) || "off".equals(value))) {
badUsage(command, "-expand option must be 'on' or 'off'");
} else if (option.equals("ext")) {
if (!("on".equals(value) || "off".equals(value))) {
badUsage(command, "-ext option must be -ext:on or -ext:off");
} else if (option.equals("l")) {
if (!(value == null || "on".equals(value) || "off".equals(value))) {
badUsage(command, "-l option must be -l:on or -l:off");
if (value == null) {
if (args.length < i + 2) {
badUsage(command, "No resolver after -cr");
if (value == null) {
代码示例来源:origin: org.opengis.cite.saxon/saxon9
protected Source processSourceFile(String sourceFileName, boolean useURLs) throws TransformerException {
Source sourceInput;
if (useURLs || sourceFileName.startsWith("http:") || sourceFileName.startsWith("file:")) {
sourceInput = config.getURIResolver().resolve(sourceFileName, null);
if (sourceInput == null) {
sourceInput = config.getSystemURIResolver().resolve(sourceFileName, null);
}
} else if (sourceFileName.equals("-")) {
// take input from stdin
sourceInput = new StreamSource(System.in);
} else {
File sourceFile = new File(sourceFileName);
if (!sourceFile.exists()) {
quit("Source file " + sourceFile + " does not exist", 2);
}
if (Configuration.getPlatform().isJava()) {
InputSource eis = new InputSource(sourceFile.toURI().toString());
sourceInput = new SAXSource(eis);
} else {
sourceInput = new StreamSource(sourceFile.toURI().toString());
}
}
return sourceInput;
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
if (value == null) {
if (args.length < i + 2) {
badUsage(command, "No resolver after -cr");
quit(value + " is not a CollectionURIResolver", 2);
} else if (option.equals("dtd")) {
if (!("on".equals(value) || "off".equals(value))) {
badUsage(command, "-dtd option must be -dtd:on or -dtd:off");
} else if (option.equals("expand")) {
if (!("on".equals(value) || "off".equals(value))) {
badUsage(command, "-expand option must be 'on' or 'off'");
} else if (option.equals("ext")) {
if (!("on".equals(value) || "off".equals(value))) {
badUsage(command, "-ext option must be -ext:on or -ext:off");
} else if (option.equals("l")) {
if (!(value == null || "on".equals(value) || "off".equals(value))) {
badUsage(command, "-l option must be -l:on or -l:off");
if (value == null) {
if (args.length < i + 2) {
badUsage(command, "No resolver after -cr");
if (value == null) {
if (args.length < i + 2) {
badUsage(command, "No output file name after -o");
代码示例来源:origin: net.sf.saxon/Saxon-HE
boolean isStandardResolver = false;
if (resolver == null) {
resolver = getConfiguration().getStandardModuleURIResolver();
isStandardResolver = true;
if (isStandardResolver) {
quit("System problem: standard ModuleURIResolver returned null", 4);
} else {
resolver = getConfiguration().getStandardModuleURIResolver();
isStandardResolver = true;
quit("Module URI Resolver must return a single StreamSource", 2);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
private void makeXQueryTraceListener(CommandLineOptions options) {
XQueryTraceListener listener = new XQueryTraceListener();
String value = options.getOptionValue("Tout");
if (value != null) {
try {
listener.setOutputDestination(new StandardLogger(new PrintStream(value)));
} catch (FileNotFoundException e) {
badUsage("Cannot write to " + value);
}
}
value = options.getOptionValue("Tlevel");
if (value != null) {
switch (value) {
case "none":
listener.setLevelOfDetail(0);
break;
case "low":
listener.setLevelOfDetail(1);
break;
case "normal":
listener.setLevelOfDetail(2);
break;
case "high":
listener.setLevelOfDetail(3);
break;
}
}
config.setTraceListener(listener);
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
schemaAware = testIfSchemaAware(args);
config = makeConfiguration(schemaAware, null);
config.setHostLanguage(Configuration.XQUERY);
parseOptions(args, command, dynamicEnv, outputProps);
badUsage(command, moduleURIResolverClass + " is not a ModuleURIResolver");
sourceInput = processSourceFile(sourceFileName, useURLs);
exp = compileQuery(staticEnv, queryFileName, useURLs);
quit("Static error(s) in query", 2);
} else {
if (line == -1) {
explain(exp);
processSource(sourceInput, exp, dynamicEnv);
File outputFile = new File(outputFileName);
if (outputFile.isDirectory()) {
quit("Output is a directory", 2);
runQuery(exp, dynamicEnv, destination, outputProps);
} catch (TerminationException err) {
throw err;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
setPermittedOptions(options);
try {
options.setActualOptions(args);
} catch (XPathException err) {
quit(err.getMessage(), 2);
schemaAware = config.isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY);
} catch (XPathException e) {
quit(e.getMessage(), 2);
parseOptions(options);
Object mr = config.getInstance(moduleURIResolverClass, null);
if (!(mr instanceof ModuleURIResolver)) {
badUsage(moduleURIResolverClass + " is not a ModuleURIResolver");
if (schemaAware && !config.isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY)) {
if ("EE".equals(config.getEditionCode())) {
quit("Installed license does not allow schema-aware query", 2);
} else {
quit("Schema-aware query requires Saxon Enterprise Edition", 2);
sourceInput = processSourceFile(sourceFileName, useURLs);
exp = compileQuery(compiler, queryFileName, useURLs);
quit("Static error(s) in query", 2);
} else {
if (line == -1) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
closeTraceDestination = true;
} catch (FileNotFoundException e) {
badUsage("Trace output file " + value + " cannot be created");
if (value != null) {
if ("".equals(value)) {
makeXQueryTraceListener(options);
} else {
config.setTraceListenerClass(value);
config.setTraceListenerOutputFile(value);
if (options.getOptionValue("T") == null) {
makeXQueryTraceListener(options);
new StandardLogger(new File(value)));
} catch (FileNotFoundException e) {
badUsage("Trace output file " + value + " cannot be created");
badUsage("");
applyLocalOptions(options, config);
badUsage("No query file name");
badUsage("Unrecognized option: " + positional.get(currentPositionalOption));
代码示例来源:origin: net.sourceforge.saxon/saxon
protected Source processSourceFile(String sourceFileName, boolean useURLs) throws TransformerException {
Source sourceInput;
if (useURLs || sourceFileName.startsWith("http:") || sourceFileName.startsWith("file:")) {
sourceInput = config.getURIResolver().resolve(sourceFileName, null);
if (sourceInput == null) {
sourceInput = config.getSystemURIResolver().resolve(sourceFileName, null);
}
} else if (sourceFileName.equals("-")) {
// take input from stdin
sourceInput = new StreamSource(System.in);
} else {
File sourceFile = new File(sourceFileName);
if (!sourceFile.exists()) {
quit("Source file " + sourceFile + " does not exist", 2);
}
if (Configuration.getPlatform().isJava()) {
InputSource eis = new InputSource(sourceFile.toURI().toString());
sourceInput = new SAXSource(eis);
} else {
sourceInput = new StreamSource(sourceFile.toURI().toString());
}
}
return sourceInput;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
boolean isStandardResolver = false;
if (resolver == null) {
resolver = getConfiguration().getStandardModuleURIResolver();
isStandardResolver = true;
if (isStandardResolver) {
quit("System problem: standard ModuleURIResolver returned null", 4);
} else {
resolver = getConfiguration().getStandardModuleURIResolver();
isStandardResolver = true;
quit("Module URI Resolver must return a single StreamSource", 2);
代码示例来源:origin: net.sf.saxon/Saxon-HE
private void makeXQueryTraceListener(CommandLineOptions options) {
XQueryTraceListener listener = new XQueryTraceListener();
String value = options.getOptionValue("Tout");
if (value != null) {
try {
listener.setOutputDestination(new StandardLogger(new PrintStream(value)));
} catch (FileNotFoundException e) {
badUsage("Cannot write to " + value);
}
}
value = options.getOptionValue("Tlevel");
if (value != null) {
switch (value) {
case "none":
listener.setLevelOfDetail(0);
break;
case "low":
listener.setLevelOfDetail(1);
break;
case "normal":
listener.setLevelOfDetail(2);
break;
case "high":
listener.setLevelOfDetail(3);
break;
}
}
config.setTraceListener(listener);
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Main program, can be used directly from the command line.
* <p>The format is:</p>
* <p>java net.sf.saxon.Query [options] <i>query-file</i> ><i>output-file</i></p>
* <p>followed by any number of parameters in the form {keyword=value}... which can be
* referenced from within the query.</p>
* <p>This program executes the query in query-file.</p>
*
* @param args List of arguments supplied on operating system command line
*/
public static void main(String args[]) {
// the real work is delegated to another routine so that it can be used in a subclass
new Query().doQuery(args, "java net.sf.saxon.Query");
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
protected Source processSourceFile(String sourceFileName, boolean useURLs) throws TransformerException {
Source sourceInput;
if (useURLs || CommandLineOptions.isImplicitURI(sourceFileName)) {
sourceInput = config.getURIResolver().resolve(sourceFileName, null);
if (sourceInput == null) {
sourceInput = config.getSystemURIResolver().resolve(sourceFileName, null);
}
} else if (sourceFileName.equals("-")) {
// take input from stdin
sourceInput = new StreamSource(System.in);
} else {
File sourceFile = new File(sourceFileName);
if (!sourceFile.exists()) {
quit("Source file " + sourceFile + " does not exist", 2);
}
if (Version.platform.isJava()) {
InputSource eis = new InputSource(sourceFile.toURI().toString());
sourceInput = new SAXSource(eis);
} else {
sourceInput = new StreamSource(sourceFile.toURI().toString());
}
}
return sourceInput;
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Main program, can be used directly from the command line.
* <p>The format is:</P>
* <p>java net.sf.saxon.Query [options] <I>query-file</I> ><I>output-file</I></P>
* <p>followed by any number of parameters in the form {keyword=value}... which can be
* referenced from within the query.</p>
* <p>This program executes the query in query-file.</p>
*
* @param args List of arguments supplied on operating system command line
* @throws Exception Indicates that a compile-time or
* run-time error occurred
*/
public static void main(String args[])
throws Exception {
// the real work is delegated to another routine so that it can be used in a subclass
(new Query()).doQuery(args, "java net.sf.saxon.Query");
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
protected Source processSourceFile(String sourceFileName, boolean useURLs) throws TransformerException {
Source sourceInput;
if (useURLs || CommandLineOptions.isImplicitURI(sourceFileName)) {
sourceInput = config.getURIResolver().resolve(sourceFileName, null);
if (sourceInput == null) {
sourceInput = config.getSystemURIResolver().resolve(sourceFileName, null);
}
} else if (sourceFileName.equals("-")) {
// take input from stdin
sourceInput = new StreamSource(System.in);
} else {
File sourceFile = new File(sourceFileName);
if (!sourceFile.exists()) {
quit("Source file " + sourceFile + " does not exist", 2);
}
if (Version.platform.isJava()) {
InputSource eis = new InputSource(sourceFile.toURI().toString());
sourceInput = new SAXSource(eis);
} else {
sourceInput = new StreamSource(sourceFile.toURI().toString());
}
}
return sourceInput;
}
内容来源于网络,如有侵权,请联系作者删除!