0

错误:

错误

然而,从控制台,所需的输出:

nicholas@mordor:~$ 
nicholas@mordor:~$ curl http://localhost:8080/exist/rest/db/scripts/notes.xq
<notes>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

<note>
foo
</note>

<note>
bar
</note>

</notes>
<notes>
<note>
foo
</note>
<note>
bar
</note>
<note>
baz
</note>
</notes>nicholas@mordor:~$ 
nicholas@mordor:~$ 
nicholas@mordor:~$ lynx http://localhost:8080/exist/rest/db/scripts/notes.xq  --dump
<notes>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

<note>
foo
</note>

<note>
bar
</note>

</notes>
<notes>
<note>
foo
</note>
<note>
bar
</note>
<note>
baz
</note>
</notes>nicholas@mordor:~$ 
nicholas@mordor:~$ 

所以这就是我正在寻找的输出,或类似的输出,来自 Firefox。

eXide

FLWOR: _

xquery version "3.0";

for $note in collection('/db/tmp')/notes
return $note

这就像我能做到的一样简单。

eXide从 GUI 控制台返回的内容:

<notes>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

<note>
foo
</note>

<note>
bar
</note>

</notes>
2
<notes>
<note>
foo
</note>
<note>
bar
</note>
<note>
baz
</note>
</notes>

这是我正在寻找的输出。

所以也许这更像是浏览器的配置错误而不是其他任何东西

4

1 回答 1

1

此 XML 文件中有两个<notes>…&lt;/notes>标签。XML 规范声明您可能只有一个根元素。

要解决此问题,请删除:

</notes>
<notes>

在文档的中间。<note>…&lt;/note>这将在单个<notes>…&lt;/notes>根中为您提供六个标签。

curl 起作用的原因是它不尝试解析 XML,而只是显示纯文本结果。

于 2020-11-22T09:05:47.707 回答