0
votes

I have a xml payload as below,

<ret:msgData xmlns:ret="http://example.com/ret" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <users>
        <fbuser>user1</fbuser>
        <fbuser>user2</fbuser>
        <googleuser>user2</googleuser>
    </users>
</ret:msgData>

From this payload I need all the fbuser nodes. For this I used below xpath in property mediator in esb. But it gives me values and not nodes.

 <property xmlns:ret="http://example.com/ret"
           name="fbuser"
           expression="//ret:msgData/users/fbuser"
           scope="default"
           type="STRING"/>
 <log level="custom" separator=",">
    <property name="fbuser" expression="get-property('fbuser')"/>
 </log>

The output that gets printed is user1user2 Instead I am looking for output as below.

<fbuser>user1</fbuser>
<fbuser>user2</fbuser>

When I test the xpath in http://www.freeformatter.com/xpath-tester.html The same code gives me proper output.

Please suggest.

1
Tried that, it does not work.ViS

1 Answers

0
votes

Honestly this would be better solved using XSLT, which is designed for extracting / converting XML from one application to another.