我有以下 XML,我使用 Xquery 使用 Qexo 查询一些结果。如何仅查询从属关系等属性?就像我想查询每个作者的所有附属机构一样?
我可以做更简单的,但这很棘手,没有任何在线参考......
<conference>
<paper>
<conferencename>VLDB</conferencename>
<year>2006</year>
<author affiliation="ASU"> K. Selçuk Candan</author>
<author affiliation="NEC America"> Wang-Pin Hsiung</author>
<author affiliation="Turn"> Songting Chen</author>
<author affiliation="NEC America"> Jun'ichi Tatemura</author>
<author affiliation="UCSB">Divyakant Agarwal</author>
<Article>AFilter: Adaptable XML Filtering with Prefix-Caching and Suffix-Clustering. 559-570
Electronic Edition (link) BibTeX </Article>
<place>Seoul, Korea</place>
</paper>
</conference>
只是为了返回所有值,这是使用的 Xquery。
for $x in doc("vldb.xml")/conference/paper
where $x/conferencename = "VLDB"
order by $x/Author
return
<x>
{ $x/Author, $x/Article, $x/conferencename, $x/year}
</x>