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からの同様の出力です。

エキシド

FLWOR:_

xquery version "3.0";

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

これは私ができる限り簡単です。

eXideGUI コンソールから返されるもの:

<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

<notes>…&lt;/notes>この XML ファイルには 2 つのタグがあります。XML 仕様では、ルート要素は 1 つしか持てないと規定されています。

これを修正するには、以下を削除します。

</notes>
<notes>

書類の真ん中。これにより、1 つのルート<note>…&lt;/note>内に 6 つのタグが作成されます。<notes>…&lt;/notes>

curl が機能する理由は、XML を解析しようとしているのではなく、プレーン テキストの結果を表示しているだけだからです。

于 2020-11-22T09:05:47.707 に答える