如何在JavaScript+;标记逻辑
我有xml文档,比如-如何在JavaScript+;标记逻辑,javascript,marklogic,marklogic-8,Javascript,Marklogic,Marklogic 8,我有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> 但为此,我需要声明名称空间c。是xQuery吗?我们本可以这样做的- cts.elementValueQuery(xs.QName("c:id"), "
<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>
但为此,我需要声明名称空间c
。是xQuery吗?我们本可以这样做的-
cts.elementValueQuery(xs.QName("c:id"), "http://example.com/xyz/no-data")
declare namespace c="http://example.com/ns/core";
但是我不知道如何在JavaScript中实现这一点。您可以使用而不是xs.QName()。在下面的示例中,我将nsC
(namespace-C)声明为类似于声明的名称空间前缀的内容
const nsC = "http://example.com/ns/core";
cts.elementValueQuery(
fn.QName(nsC, "id"),
"http://example.com/xyz/no-data"
)