我有xml文档,比如-
<domain xmlns:c="http://example.com/ns/core" xmlns="http://example.com/ns/core">
<c:id>http://example.com/xyz/no-data</c:id>
</domain>我在MarkLogic中使用MarkLogic,并希望在c:id上运行元素值查询。就像这样-
cts.elementValueQuery(xs.QName("c:id"), "http://example.com/xyz/no-data")但为此,我需要声明名称空间c。如果是xQuery,我们可以做这样的事情吗-
declare namespace c="http://example.com/ns/core";但我无法在JavaScript中了解如何做到这一点。
发布于 2016-10-19 11:24:36
您可以使用fn.QName()而不是xs.QName()。在下面的示例中,我声明了nsC (命名空间-C)类似于声明的命名空间前缀。
const nsC = "http://example.com/ns/core";
cts.elementValueQuery(
fn.QName(nsC, "id"),
"http://example.com/xyz/no-data"
)https://stackoverflow.com/questions/40127782
复制相似问题