Sam*_*Sam 2 command-line xquery saxon
听起来我需要某种类型的XML处理器
它看起来像是一个名为Saxon的程序,我可以用来运行XQuery
当我尝试这个网站的例子时,我得到了
Error: Could not find or load main class net.sf.saxon.Query
Run Code Online (Sandbox Code Playgroud)
我不知道如何从我下载的saxon包中设置java包.
我想知道是否有一个更简单的选项,能够从命令行运行XQuery,而不是这个java包?我想要做的就是处理一个xml文件,其命令如"Select where type ="something"".
我的Xidel是一个命令行XQuery 3.0工具.
xidel your-file.xml --xquery 'your-xquery'
Run Code Online (Sandbox Code Playgroud)
但"选择哪里"不是XQuery.XQuery看起来像for ... in .. where .. return或者//*[..where..],例如
xidel your-file.xml -e "//*[@type = 'something']"
Run Code Online (Sandbox Code Playgroud)
Xidel -e是以下参数的缩写--xpath或--xquery依赖于以下参数(如果您不尝试创建新的XML文档,XPath与XQuery几乎相同),如果您需要"或'依赖于从bash或cmd控制台调用它
BaseX提供XQuery 3.0支持,并与封装调用Java的脚本打包在一起,包括设置类路径:
$ basex --help
BaseX 8.5.3 [Standalone]
Usage: basex [-bcdiIoqrRstuvVwxXz] [input]
[input] XQuery or command file, or query string
-b<pars> Bind external query variables
-c<input> Execute commands from file or string
-d Activate debugging mode
-i<input> Assign file or database to context
-I<input> Assign input string to context
-o<output> Write output to file
-q<expr> Execute XQuery expression
-r<num> Set number of query executions
-R Turn query execution on/off
-s<pars> Set serialization parameter(s)
-t[path] Run tests in file or directory
-u Write updates back to original files
-v/V Show (all) process info
-w Preserve whitespaces from input files
-x Show query plan
-X Show query plan before/after compilation
-z Skip output of results
Run Code Online (Sandbox Code Playgroud)