问题标签 [xquery-update]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 我可以让 XQuery 在与 XQJ 绑定的变量中计算 { $expression } 吗?
为了模拟 XQuery Update 中的自动增量值,假设<root count="0"/>
第一次运行时,以下工作正常:
......很好的产量:
但是,我想在我的 Java 代码中定义节点,然后将其绑定为org.w3c.dom.Node
or Document
,甚至String
。喜欢:
但是,这只是给我留下了属性中的文本 { $count }
。将节点绑定为xs:string
值具有相同的效果。
当然,这是防止“XQuery 注入”的一个很好的保护措施。仍然如此:有什么方法可以使 XQuery 更新过程成为我在变量本身中包含的表达式?
(在 XQuery 中使用自动增量值的任何其他聪明的想法也非常受欢迎,但是请参阅Auto increment with XQuery Update?)
replace - BaseX XQuery 替换
我有以下问题。我想通过使用 baseX 作为数据库来替换我的 xquery 文件中元素的值。xquery代码如下:
xml 文档包含以下元素:
每次我想执行这个 xquery 时都会抛出这样的错误:
那么我应该做什么或改变,只是将元素中的文本“test”替换为“haha”?如果我只使用这行代码它可以工作,但我必须读出 URL-Parameter 所以我需要更多的代码行,除了“replace ....”行!
xml - XQuery 同时获取和插入
我正在检索数据并将其插入另一个文件。但是插入的数据没有排序。以下是我想要实现的示例。
的输出fruits
如下 -
它没有被订购,虽然在检索时提到......!
xquery - 一个节点中的 Xquery 多个结果
当我尝试在 xml 文件上执行我的 Xquery 代码时,我在我的一个字段中得到了多个结果。
这是我的xml文件
我的 xquery 文件
最重要的是我的结果
如何在director字段中只获取一个值?
我的程序:- 我在 (../Movie/@TITLE) 上运行了不同的值函数,这给了我显示标题的答案。但是由于标题和导演是电影的属性,我无法使用另一个访问一个。当我迭代演员时,由于有两个演员为一部电影指定一个导演,导演的名字会被打印两次。当我遍历电影时,我不能在它上面使用不同的值,因为它不是一个属性。
sql-server - 如果节点存在,则xquery替换值
我正在使用 xQuery,如果元素下不存在test
元素标记,我正在尝试替换元素的值。Active
User
(我添加了引号以便能够在此处正确显示...)
为此,我收到此错误:
XQuery [modify()]:'value' 附近的语法错误,预期为 'else'。
我做错了什么?
xquery - Update multiple XML files using XQuery and Zorba
Is there a simple way using the Zorba XQuery Processor to update multiple XML files and save the output of the modification back in the same file?
So far I have figured out how to process multiple files using the File module and the file:list extension to find all the XML files in a directory. I then loop through each document and run an XQuery Update statement (replace value of node {} with {}). The problem is that this doesn't actually modify the file.
I was using Saxon before, but the license costs are too expensive for this particular project. In Saxon EE, if I ran a "replace value of node" on an open document, the document would be updated on the disk when the query was finished. I suspect Zorba doesn't work this way, instead only modifying the value in memory during the query. If I was editing one file I would just output the modified XML in Zorba and pipe that back to the input file, but in this case I want to update many files. Is that possible in one query?
Here is what the code looks like:
xquery - 使用 Xquery 向现有 XML 中的元素添加属性
我需要使用 XQuery 向我的响应 XML 的元素添加一个属性。将以下 XML 作为输入,
需要一个 Xquery 来添加一个属性newAtt和值newVal并给出结果,
每次消息头的属性数量可能会发生变化。因此查询应该添加一个新属性以及所有现有属性并返回整个文档。
xquery - XQuery 比较两个文档并替换具有相同名称的节点
我有一个结构如下的文档:
INVT_DATA 的子子元素始终是元素,而不是文本节点。我想使用 XQuery 来比较具有相同结构的新文档。如果新元素和原始元素中都存在子元素,则应将其替换。如果新元素中存在子元素,但旧元素中不存在,则应将其附加到 INVT_DATA。
我认为这个 XQuery 会起作用,但它似乎总是只是附加节点:
我搜索了其他类似的问题并找到了这个,但这对于我想做的事情来说有点过分了。有什么建议么?如果有帮助,我将使用 Oracle XML DB 版本 11.2.0.3 中的 XmlQuery。
xquery - 使用 xquery 调用数据库,给出重复值
我正在使用 XQuery 来查询 OSB 项目中的数据库。考虑下表:
和 XQuery
对于此查询,我得到的结果为<root>Dheepan Raju</root>
. 但我只需要返回一行,即使查询返回不止一行,如下所示<root>Dheepan</root>
。我[1]
在查询中使用了谓词,但不知道为什么它连接值并返回。当返回多行时,谁能告诉我如何只返回第一行。
xquery - 如何使用 xquery 更新将节点内的文本转换为子节点?
我有一个像
如何使用所有节点转换此文档,这意味着如果节点包含文本text
并将child node
其转换为子节点(比如说childtext)使用 xquery-update
这是我尝试过的:
我无法删除具有兄弟节点的文本。