小飞哥

camel with xquery

myTransform.xquery文件:
<persons>
{
  for $b in (persons/person)
  return
    if($b/age>20)
    then
    <man>
     {$b/firstName}
    </man>
    else
    ""
}   
</persons>
message.xml
<persons>
<person user="james">
  <firstName>James</firstName>
  <lastName>Strachan</lastName>
  <city>London</city>
  <age>20</age>
</person>
<person user="xiaofei">
  <firstName>xiaofei</firstName>
  <lastName>liu</lastName>
  <city>ShangHai</city>
  <age>23</age>
</person>
<person user="tony">
  <firstName>tony</firstName>
  <lastName>liu</lastName>
  <city>ShangHai</city>
  <age>23</age>
</person>
</persons>
camelcontext.xml:
<route>
      <from uri="file:src/data?noop=true"/>
      <to uri="xquery:myTransform.xquery"/>
  <to uri="file:target/outputFiles"/>
    </route>

out:
<persons>
 <man>
  <firstName>xiaofei</firstName>
 </man>
 <man>
  <firstName>tony</firstName>
 </man>
</persons>

posted on 2010-02-01 11:10 小飞哥 阅读(1616) 评论(0)  编辑  收藏 所属分类: camel


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


网站导航:
 

My Links

News

常用链接

随笔分类

最新随笔

最新评论

阅读排行榜

评论排行榜