handling repeating xml elements in mule

muleDev
  <?xml version="1.0" encoding="UTF-8"?>
   <root xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">                                                                   
   <input>
    <rows>
     <example>
        <string>1</string>
        <string>345</string>
        <string>fg8</string>
        <string>8384</string>
     </example>
     <example>
        <string>2</string>
        <string>453</string>
        <string>8</string>
        <string>dsrsg</string>
     </example>
     <example>
        <string>3</string>
        <string>3456</string>
        <string>11</string>
        <string>grthy</string>
     </example>
     </rows>
   </input>
  </root>                                                                               

Here i have to capture the each example tag and have to get the string values and insert into the db. Im trying to get the values by using xpath but no luck. Also tried by coverting to java object. Please suggest me , how to handle this scenario.

sample code:

 <http:listener config-ref="HTTP_Listener_Configuration1" path="/" doc:name="HTTP"/>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    <byte-array-to-object-transformer  mimeType="application/xml" doc:name="Byte Array to Object"/>
    <splitter expression="#[xpath3('/*:root/input/rows', payload, 'NODESET')]" doc:name="Splitter"/>
    <logger message="splitter : #[payload]" level="INFO" doc:name="Logger"/>
Ralph Rimorin

@muleDev, try this Dataweave script:

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related