Xquery在marklogic qconsole上的箭头上给出错误
我正在尝试使用marklogic提供的代码片段进行简单的文档插入Xquery在marklogic qconsole上的箭头上给出错误,xquery,marklogic,Xquery,Marklogic,我正在尝试使用marklogic提供的代码片段进行简单的文档插入 xdmp:document-insert("/test/shipment1.xml", <shiporder orderid="889923"> <orderperson>John Smith</orderperson> <shipto> <name>Ola Nordmann</name> <address>Langgt 2
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"))
);
xdmp:documentinsert(“/test/shipment1.xml”,
约翰·史密斯
奥拉诺德曼
朗格特23
>4000斯塔万格
挪威
皇帝讽刺剧
特别版
行业特别版
1.
10.90
隐藏你的心
1.
9.90
,
map:map()=>map:with(“集合”,“实践”))
);
这就是我在收集行时遇到的错误
[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 "1.0-ml"; 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
[1.0-ml]XDMP-UNEXPECTED:(错误:XPST0003)意外的令牌语法错误、意外的Gt、预期的函数30或百分比_
堆栈跟踪
在第32行第11列:
在xdmp:eval(“xquery版本“1.0-ml”
;声明名称空间html=…”,(),140786953283574700089988080359119…)
30. ,
31
32map:map()=>map:with(“集合”,“实践”))
33. );
34
.
MarkLogic扩展语法使用,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"
);
xdmp:文档插入
(
“/test/shipment1.xml”
,
约翰·史密斯
奥拉诺德曼
.只能从MarkLogic的版本X开始使用“箭头运算符”
(我手头没有确切的版本,我相信它在8到9之间。)
您可以在MarkLogic支持的任何XQuery“版本”中使用它(3.1
,但也可以1.0-ml
)。以下两个表达式(带和不带箭头运算符)产生完全相同的结果:
(: if you use 3.1 instead, you need to declare the namespace prefix "map" :)
xquery version "1.0-ml";
map:new((
map:entry('foo', 1),
map:entry('bar', 2)))
,
map:map()
=> map:with('foo', 1)
=> map:with('bar', 2)
如果只有一个条目,甚至可以在第一个符号中去掉map:new
:
map:entry('foo', 1)
,
map:map()
=> map:with('foo', 1)
正如其他人提到的,在您的特定示例中,您可以简单地传递不同的参数。但是现在您知道了箭头运算符。在9.0-11中运行良好。您的城市标记中确实有一个额外的
。。