Вопрос

I am trying to construct a map from XML, which contains `cts:element-range-query for one of the values. When I run it in cq it throws XDMP-QUERYNOVALS. The same XML works in ML5. Is there any settings which needs to be changed for this to work in ML7?

let $request-body := <wrapper xmlns="xdmp:http">
  <map:map xmlns:map="http://marklogic.com/xdmp/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <map:entry key="GLOBAL">
      <map:value><cts:and-query xmlns:cts="http://marklogic.com/cts">
                  <cts:or-query>
                    <cts:element-range-query operator="=">
                      <cts:element>abcd</cts:element>
                    </cts:element-range-query>
                  </cts:or-query>
        </cts:and-query></map:value>
  </map:entry>
</map:map></wrapper>    
return map:map($request-body/node())

Error Message:

[1.0-ml] XDMP-QUERYNOVALS: map:map(
<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:map="http://marklogic.com/xdmp/map" xmlns="xdmp:http">
<map:entry key="GLOBAL"><map:value><cts:and-query xmlns:cts="htt...</map:map>)
 -- /*:wrapper/map:map/map:entry/map:value/cts:and-query/cts:or-query/cts:element-range-query

Thanks, Selva

Это было полезно?

Решение

Look closely at the cts:element-range-query XML. It has no cts:value element. So the cts:query XML is invalid. That could happen if you built the cts:query XML automatically, and never validated it.

MarkLogic 7 may be stricter about this than MarkLogic 5 was, but with either version the XML does not represent a valid query.

Другие советы

Selva:

You can only pass in the XML serialization of a map to the map constructor. The map constructor doesn't cast other XML structures to a map.

To understand the XML serialization of a map, please see the examples in:

http://docs.marklogic.com/map:map

However, after constructing a map, you can use the map:put() function to add atomic values or nodes to the map. So, you can write an XQuery function that populates the map with values or fragments extracted from the node and use that as if it were a map constructor.

Hoping that helps,

Erik Hennum

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top