【问题标题】:XML attributes query in Qexo.Qexo 中的 XML 属性查询。
【发布时间】:2012-01-23 17:42:39
【问题描述】:

我有以下 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>

【问题讨论】:

    标签: xml xquery xquery-sql


    【解决方案1】:

    您忘记指定想要的输出是什么 ...?

    试试这样的

    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> 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多