You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dfgcamel <df...@gmail.com> on 2016/03/30 23:30:49 UTC

converting xml fragment to java object

All,

I'm trying to handle the response from a PayPal reporting xml request. 
Below is a fragment of the larger xml:

<getMetaDataResponse>
  <reportId>#########64</reportId>
  <numberOfRows>2</numberOfRows>
  <numberOfPages>1</numberOfPages>
  <pageSize>1000</pageSize>
  <numberOfColumns>55</numberOfColumns>
  <columnMetaData colNum="1">
    <dataName>Transaction ID</dataName>
    <dataType>string</dataType>
  </columnMetaData>
  <columnMetaData colNum="2">
    <dataName>Time</dataName>
    <dataType>date</dataType>
  </columnMetaData>
...
...
...
</getMetaDataResponse>


I was trying to use the bold section of code to handle each row
(<columnMetaData> tag).  I'm not quite sure how to approach this.  I want to
store each row as a java object that will then be persisted to an oracle
database.  Any recomendations/examples.  Also the current code that I have
below, I get the following error, "The method otherwise() is undefined for
the type ExpressionNode".

Thanks,,


Dennis



	public void configure() throws Exception {

		try {
			from("quartz2://myGroupName/myTimerName?cron=0/20+*+*+*+*+?")
					.process(new RunReport()).to(JETTY_STRING)
		               .choice()
					      .when().xpath("/reportingEngineResponse/baseResponse/responseCode
= '100' and /reportingEngineResponse/runReportResponse/statusCode = '3'")
					         .log("Valid report response received\n")
	                         .process(new ReportResults()).to(JETTY_STRING)
	                            /*
	                             * Get Report Results
	                             */
	                            .choice()
	                              
.when().xpath("/reportingEngineResponse/baseResponse/responseCode = '100'
and /reportingEngineResponse/getResultsResponse/Results/statusCode = '3'")
	                                  .log("Valid results response received\n")
	                                  .process(new
ReportMetaData()).to(JETTY_STRING)
	                                     /*
	                                      * Get Report MetaData
	                                      */
	                                     .choice()
/                                       
.when().xpath("/reportingEngineResponse/baseResponse/responseCode 	= '100'")
	                                           .log("Valid MetaData
received\n")
	                                          
.split(body().tokenizeXML("columnMetaData",
"getMetaDataResponse")).streaming().*process(new MetaDataResponseHandler())*
/	                                        .otherwise()
	                                           .log("No Report MetaData
Received\n")
	                                           .process(new ErrorHandler())
	                                     .endChoice() // End Get MetaData



--
View this message in context: http://camel.465427.n5.nabble.com/converting-xml-fragment-to-java-object-tp5780107.html
Sent from the Camel - Users mailing list archive at Nabble.com.