Hi, I just wrote a simple unit test which was based on your case in Camel 2.0 trunk. The code works for me, please feel free to check it[1] out.
[1] http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/XPathFunctionTest.java?view=diff&r1=778973&r2=778974&pathrev=778974 Willem Nasim Anza wrote: > Hi, > I've tried with NodeList in the Camel configure() method : > from("direct:start").setProperty("Addresses").xpath("//Address", > NodeList.class) > .process(myCamelProcessor); > > In the Process(Exchange ex) method I got a ClassCastException when I tried > to get values : > NodeList adresses = (NodeList)ex.getProperty("Addresses"); > > Any idea will be apprecioated. > Thanks > > Nasmo > > > and in the procesor > > On Sat, May 23, 2009 at 7:42 AM, Claus Ibsen <[email protected]> wrote: > >> On Wed, May 20, 2009 at 2:39 PM, Nasim Anza <[email protected]> >> wrote: >>> Hi, >>> >>> I would like to get a list of values from an XML input using the Camel >>> route. >>> Assume that we have an XML input like below : >>> >>> <soapenv:Envelope xmlns:soapenv=" >> http://schemas.xmlsoap.org/soap/envelope/" >>> xmlns:ns="http://myNamesapce"> >>> <soapenv:Header/> >>> <soapenv:Body> >>> <ns:Addresses> >>> <Address>address1</Address> >>> <Address>address2</Address> >>> <Address>address3</Address> >>> <Address>address4</Address> >>> </ns:Addresses> >>> </soapenv:Body> >>> </soapenv:Envelope> >>> >>> How to get the list of address values from a Camel Processor within a >> route >>> : >>> >>> from("direct:start") >>> .setProperty("Addresses").xpath("//Address", ArrayList.class) >>> .process(myCamelProcessor); >> Hi >> >> Have you tried without the ArrayList.class as the xpath is kind hard >> to get working. As it tends to want to use XML types such as NodeList >> etc. >> >> >> >>> Thanks for help >>> >>> Nasmo >>> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >
