如何在mule中检索特定的xml元素

时间:2015-05-05 12:48:16

标签: mule

<splitter evaluator="xpath" expression="/productdata/productsList" doc:name="Splitter"/> 
<transformer ref="domToXml" doc:name="Transformer Reference"/> 
<logger level="INFO" doc:name="Logger" message=" productsList...#[message.payload]" />

我输入了如下的xml数据。我想显示所有productname.above代码没有。任何帮助表示感谢。

<productdata>
     <productsList>
             <product>
                 <productid>100</productid>
                 <productname>handbag</productname>
                 <desc>accessioes</desc>             
            </product>
            <product>
                   <productid>101</productid>
                 <productname>watch</productname>
                 <desc>accessioes</desc>

            </product>     
         </productsList>
         </productdata>

1 个答案:

答案 0 :(得分:1)

查看xpath3 MEL函数:critical render path

xpath如果使用Mule版本&lt; 3.6:http://www.mulesoft.org/documentation/display/current/Mule+Expression+Language+Reference#MuleExpressionLanguageReference-XpathandRegex

<splitter expression="#[xpath3('//productsList/product', message.payload, 'NODESET')]" />

<logger level="ERROR" message=" #[xpath3('productname', payload, 'STRING')]" />