MarkLogic结构查询搜索
我有下面的xmlMarkLogic结构查询搜索,marklogic,marklogic-8,Marklogic,Marklogic 8,我有下面的xml <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> <cpf:processing-status xmlns:cpf="http://marklogic.com/cpf">done</cpf:processing-status> <cpf:property-hash xmlns:cpf="http://marklogic.com/cpf">6b
<prop:properties xmlns:prop="http://marklogic.com/xdmp/property">
<cpf:processing-status xmlns:cpf="http://marklogic.com/cpf">done</cpf:processing-status>
<cpf:property-hash xmlns:cpf="http://marklogic.com/cpf">6b9dab35ed148cd08bba59503892a0fd</cpf:property-hash>
<cpf:last-updated xmlns:cpf="http://marklogic.com/cpf">2017-05-23T17:56:54.5734822+05:30</cpf:last-updated>
<cpf:state xmlns:cpf="http://marklogic.com/cpf">http://marklogic.com/states/converted</cpf:state>
<lnk:link from="/mycompany/mlabcNew_doc.xhtml" to="/mycompany/mlabcNew.doc" rel="source" rev="conversion" strength="strong" xmlns:lnk="http://marklogic.com/cpf/links"/>
<cpf:self xmlns:cpf="http://marklogic.com/cpf">/mycompany/mlabcNew.doc</cpf:self>
</prop:properties>
我没找到办法得到这个。请帮助根据您的示例,名为“to”的属性的命名空间不是cpf/links命名空间 尝试: 注意:在对此类问题进行故障排除时,我通常使用xPath在查询控制台中确认元素和属性名称以及名称空间。这将删除许多层,并在某些情况下使故障排除更加简单
StructuredQueryBuilder qb = queryMgr.newStructuredQueryBuilder();
StructuredQueryDefinition query = qb.properties(
qb.word(qb.elementAttribute(
qb.element(new QName("http://marklogic.com/cpf/links", "link")),
qb.attribute(new QName("http://marklogic.com/cpf/links", "to"))),
"/mycompany/mlabcNew_doc.xhtml"));
StructuredQueryBuilder qb = queryMgr.newStructuredQueryBuilder();
StructuredQueryDefinition query = qb.properties(
qb.word(qb.elementAttribute(
qb.element(new QName("http://marklogic.com/cpf/links", "link")),
qb.attribute(new QName("", "to"))),
"/mycompany/mlabcNew_doc.xhtml"));