当xpath包含名称空间前缀时,路径索引由cts:path-reference识别 [英] path index is recognized by cts:path-reference when xpath contains namespace prefix
问题描述
如果一个元素在XML中存在多个位置. 然后,很难对特定元素上的数据进行排序(默认情况下,文档将对第一个元素进行排序).
If an element exists more than one places in a XML. Then it was difficult to sort the data on a particular element (by default docs will be sorted on the first element).
我能够通过定义path-index
并将其传递给cts:path-reference
查询来解决此问题.
I was able to solve this problem by defining a path-index
and passing it to cts:path-reference
query.
但是,如果xpath contains
命名空间前缀(为xml定义了命名空间),则cts:path-reference
无法找到defined path-index
.
But if the xpath contains
a namespace prefix(namespace is defined for the xml) then cts:path-reference
is not able to find the defined path-index
.
我收到以下错误.
SEARCH-BADORDERBY: (err:FOER0000) Indexes are required to support element, element-attribute, json-property, or field sort specifications
无法理解为什么出现此错误. 请帮忙!
Not able to understand why I am getting this error. Please help!
推荐答案
有关路径索引的一些好的做法:
Some good practices around path indexes:
- 确保在声明索引时以及使用索引时都使用完全相同的路径表达式字符串,包括相同的前缀
- 声明前缀至少是路径名称空间,可以选择在应用程序服务器级别代替
- cts:path-reference 带有第三个参数,您可以使用该参数传递命名空间绑定
- Make sure you use the exact same path expression string both when declaring the index, and when using it, including identical prefixes
- Declare the prefixes are path namespaces at the least, optionally at app server level instead
- cts:path-reference takes a third parameter with which you can pass in namespace bindings
HTH!
这篇关于当xpath包含名称空间前缀时,路径索引由cts:path-reference识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!