weidagang2046的专栏

物格而后知致
随笔 - 8, 文章 - 409, 评论 - 101, 引用 - 0
数据加载中……

A Simple XQuery Case

<? xml version="1.0" encoding="ISO-8859-1" ?>
< bookstore >

    
< book  category ="COOKING" >   
        
< title  lang ="en" > Everyday Italian </ title >
        
< author > Giada De Laurentiis </ author >
        
< year > 2005 </ year >
        
< price > 30.00 </ price >
    
</ book >
    
    
< book  category ="CHILDREN" >
        
< title  lang ="en" > Harry Potter </ title >
        
< author > J K. Rowling </ author >
        
< year > 2005 </ year >
        
< price > 29.99 </ price >
    
</ book >
    
    
< book  category ="WEB" >
        
< title  lang ="en" > XQuery Kick Start </ title >
        
< author > James McGovern </ author >
        
< author > Per Bothner </ author >
        
< author > Kurt Cagle </ author >
        
< author > James Linn </ author >
        
< author > Vaidyanathan Nagarajan </ author >
        
< year > 2003 </ year >
        
< price > 49.99 </ price >
    
</ book >
    
    
< book  category ="WEB" >
        
< title  lang ="en" > Learning XML </ title >
        
< author > Erik T. Ray </ author >
        
< year > 2003 </ year >
        
< price > 39.95 </ price >
    
</ book >
    
</ bookstore >
book.xml

<names>
{
for $x in doc("book.xml")/bookstore/book
where $x/price > 30
return 
<name>{$x/title/text()}</name>
}
</names>
query.xq

<names>
    
<name>XQuery Kick Start</name>
    
<name>Learning XML</name>
</names>
names.xml

posted on 2007-01-14 00:11 weidagang2046 阅读(218) 评论(0)  编辑  收藏 所属分类: XML


只有注册用户登录后才能发表评论。


网站导航: