在命令行上运行XQuery [英] Running XQuery on the command line

查看:145
本文介绍了在命令行上运行XQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

听起来我需要某种类型的XML处理器

It sounds like I need some type of XML processor

似乎有一个名为Saxon的程序,可以用来运行XQuery

It looks like theres a program called Saxon which I can use to run XQuery

当我尝试此网站示例我得到

Error: Could not find or load main class net.sf.saxon.Query

我不知道如何从 saxon程序包

Id想知道是否有一个更简单的选项可以从命令行(而不是Java包)运行XQuery?我要做的就是用选择何处type = something之类的命令处理xml文件。

Id like to know if there is an easier option to be able to run XQuery from the command line other than this java package? All I want to do is process an xml file with commands like "Select where type="something"".

推荐答案

我的 Xidel 是命令行XQuery 3.0工具。

My Xidel is a command-line XQuery 3.0 tool.

 xidel your-file.xml --xquery 'your-xquery'

但是选择位置不是XQuery。 XQuery看起来像 for ... in .. where .. return // ** .. where ..] ,例如

But "select where" is not XQuery. XQuery looks like for ... in .. where .. return or //*[..where..], e.g.

xidel your-file.xml -e "//*[@type = 'something']"

使用Xidel -e 是<$ c的缩写$ c>-xpath 或-xquery 取决于以下参数(如果您不尝试使用XPath,则XPath与XQuery几乎相同创建一个新的XML文档),是否需要 ',取决于您是从bash还是cmd调用它控制台

With Xidel -e is short for --xpath or --xquery depending on the following argument (XPath is pretty much the same as XQuery if you are not trying to create a new XML document), and if you need " or ' depends if you call it from the bash or cmd console

这篇关于在命令行上运行XQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆