我有以下XML,我使用Xquerry通过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>发布于 2012-01-24 22:28:50
你忘了指定什么是你想要的输出 ...?
尝试像这样的
for $x in /conference/paper
where $x/conferencename = "VLDB"
order by $x/Author
return
<x affiliation = "{$x/author/@affiliation}">
{$x/author, $x/Article, $x/conferencename, $x/year}
</x> https://stackoverflow.com/questions/8976102
复制相似问题