温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - Xquery giving error on arrow on marklogic qconsole
marklogic xquery

其他 - XQuery在marklogic qconsole上的箭头上给出错误

发布于 2020-04-04 00:12:21

我正在尝试使用marklogic提供的代码片段进行简单的文档插入。

xdmp:document-insert("/test/shipment1.xml", <shiporder orderid="889923">
  <orderperson>John Smith</orderperson>
  <shipto>
    <name>Ola Nordmann</name>
    <address>Langgt 23</address>
    <city value="BangaloreHighway">>4000 Stavanger</city>
    <country>Norway</country>
  </shipto>
  <item>
    <title>Empire Burlesque</title>
    <note>Special Edition</note>
<var>Special Edition in the industry</var>

    <quantity>1</quantity>
    <price>10.90</price>
  </item>
  <item>
    <title>Hide your heart</title>
    <quantity>1</quantity>
    <price>9.90</price>
  </item>
</shiporder>,  

map:map() => map:with("collections", ("PRACTICE"))
);

这是我在生产线上遇到的错误。

[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected Gt_, expecting Function30_ or Percent_
Stack Trace
At line 32 column 11:
In xdmp:eval("xquery version &quot;1.0-ml&quot;;&#10;declare namespace html = ...", (), <options xmlns="xdmp:eval"><database>14078695328357470008</database><modules>99880860359119...</options>)

30. </shiporder>,
31.
32. map:map() => map:with("collections", ("PRACTICE"))
33. );
34

查看更多

提问者
mjosh
被浏览
98
Ashish Patil 2020-01-31 20:57

MarkLogic extension syntax模式下不支持使用XQuery 3.1 (=>)运算符1.0-ml(这些将在MarkLogic 9及更高版本上正常运行);我相信您正在使用MarkLogic 8或更老的产品。

尝试使用:

        xdmp:document-insert
        (
            "/test/shipment1.xml"
            , 
            <shiporder orderid="889923">
                <orderperson>John Smith</orderperson>
                <shipto>
                    <name>Ola Nordmann</name>
                    <address>Langgt 23</address>
                    <city value="BangaloreHighway">>4000 Stavanger</city>
                    <country>Norway</country>
                </shipto>
                <item>
                    <title>Empire Burlesque</title>
                    <note>Special Edition</note>
                    <var>Special Edition in the industry</var>
                    <quantity>1</quantity>
                    <price>10.90</price>
                </item>
                <item>
                    <title>Hide your heart</title>
                    <quantity>1</quantity>
                    <price>9.90</price>
                </item>
            </shiporder>
            ,  
            xdmp:default-permissions()
            ,
            "PRACTICE"
        );

另外,我建议您在MarkLogic文档中引用各个MarkLogic版本的功能签名,例如docs.marklogic.com/8.0/xdmp:document-insert