我在MacOS上运行了一个干净的exist-db 4.5.0。刚刚安装了用于测试的“莎士比亚”包。当我通过浏览器运行以下请求时,我得不到任何结果。但是he5.xml是一个有效的TEI文件,并且在body中包含一个text元素。
http://127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text
<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:hits="0" exist:start="1" exist:count="0" exist:compilation-time="0" exist:execution-time="0"/>在URL中使用基本身份验证凭据(用户: admin,密码:空)不会更改任何内容。http://admin:@127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text
似乎只有//* XPATH可以工作(或者被忽略?)因为我得到了文件的全部内容。其他请求也不能工作(正确地)。就像//text()的xquery:
<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:hits="10313" exist:start="1" exist:count="10" exist:compilation-time="1" exist:execution-time="1">
The Life of King Henry the Fifth William Shakespeare Craig A. Berry, Martin Mueller, and Clifford Wulfman
</exist:result>这只是文本的第一次点击...
在Ubuntu上使用exist-db 4.4.0也尝试了这一点...同样的结果。
发布于 2019-11-23 21:22:40
我认为您在查询中犯了一个错误。你声明你尝试过:
http://127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text该查询尝试查找所有名为text的元素。我认为您可能只想获取所有的文本节点,因此您需要:
http://127.0.0.1:8080/exist/rest/apps/shakespeare/data/he5.xml?_query=//text()请注意附加的()。
此外,我认为您的URL路径看起来也很可疑,如果您正在尝试使用REST API,那么您应该使用完整的数据库集合路径,即:
http://127.0.0.1:8080/exist/rest/db/apps/shakespeare/data/he5.xml?_query=//text()请注意附加的/db。
https://stackoverflow.com/questions/58996558
复制相似问题