Hi Basically, I am trying to develop a module which pushes the customer records into database. Incoming XML contains multiple customer records.
I am wondering how I can use the CamelLoopIndex property while looping through xml records. I have some code like follows. I want to loop through records while parsing them using Xpath expressions to set them into the exchange property which later be used in camel sql insert statement. Can someone give me the syntax? Do I have to put the xpath expression inside the camel simple to access the property CamelLoopIndex ?? * <camel:when> <camel:simple>${in.header.operationName} == 'CreateOperation'</camel:simple> <camel:loop> <camel:xpath>count(//CustomerRecords/Record[${in.header.CamelLoopIndex}]/Cust_ID/text())</camel:xpath> <camel:setProperty propertyName="customerID"> <camel:xpath>//CustomerRecords/Record/Cust_ID/text()</camel:xpath> </camel:setProperty> <camel:setProperty propertyName="customerName"> <camel:xpath>//CustomerRecords/Record/Cust_Name/text()</camel:xpath> </camel:setProperty> <camel:setProperty propertyName="customerAddress"> <camel:xpath>//CustomerRecords/Record/Cust_Address/text()</camel:xpath> </camel:setProperty> <camel:setProperty propertyName="customerBalance"> <camel:xpath>//CustomerRecords/Record/Cust_Balance/text()</camel:xpath> </camel:setProperty> <camel:setProperty propertyName="customerPhoneNo"> <camel:xpath>//CustomerRecords/Record/Cust_Phone/text()</camel:xpath> </camel:setProperty> <camel:setProperty propertyName="customerPostalPIN"> <camel:xpath>//CustomerRecords/Record/Cust_PIN/text()</camel:xpath> </camel:setProperty> <camel:setBody> <camel:simple>insert into customer values('${property.customerID}','${property.customerName}','${property.customerAddress}','${property.customerBalance}','${property.customerPhoneNo}','${property.customerPostalPIN}')</camel:simple> </camel:setBody> <camel:to uri="jdbc:dataSource" /> </camel:loop> </camel:when>* ----- Reji Mathews Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews -- View this message in context: http://camel.465427.n5.nabble.com/Camel-LOOP-tp5765424.html Sent from the Camel - Users mailing list archive at Nabble.com.