You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by smilevasu6 <sr...@gmail.com> on 2014/11/26 08:20:33 UTC

camel - xml

Hi,

I am having xml data like 

<results>
	<row>
		<EMPNO>7369</EMPNO>
		<ENAME>SMITH</ENAME>
		<SAL>800</SAL>
		<DEPTNO>10</DEPTNO>
	</row>
	<row>
		<EMPNO>7499</EMPNO>
		<ENAME>SMITH></ENAME>
		<SAL>1600</SAL>
		<DEPTNO>20</DEPTNO>
	</row>
	<row>
		<EMPNO>7521</EMPNO>
		<ENAME>SMITH</ENAME>
		<SAL>1250</SAL>
		<DEPTNO>30</DEPTNO>
	</row>
	<row>
		<EMPNO>7566</EMPNO>
		<ENAME>SMITH</ENAME>
		<SAL>2975</SAL>
		<DEPTNO>20</DEPTNO>
	</row>
</results>


I am writing  a camel router like,

from("file:C://Sri/?fileName=table_export_new.xml").
		//to("file:C://Sri/table_export_new.xml").
		setHeader("results", xpath("/row/EMPNO/text()), String.class")).
		setHeader("results", xpath("/row/ENAME/text()), String.class")).
		setHeader("results", xpath("/row/SAL/text()), String.class")).
		setHeader("results", xpath("/row/DEPTNO/text()), String.class"))
	//.convertBodyTo(String.class)
		.end();

And i am getting error as 

org.apache.camel.builder.xml.InvalidXPathExpression: Invalid
xpath:/row/EMPNO/text()), String.class. Reason:
javax.xml.xpath.XPathExpressionException

Can you please help me on this?

After this i want to put the data into database as well.

Please 




--
View this message in context: http://camel.465427.n5.nabble.com/camel-xml-tp5759622.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: camel - xml

Posted by "Siano, Stephan" <st...@sap.com>.
"/row/EMPNO/text()), String.class" is really not a valid XPath. You probably want to terminate the String before the comma...

-----Original Message-----
From: smilevasu6 [mailto:srinivas.thunga@gmail.com] 
Sent: Mittwoch, 26. November 2014 08:21
To: users@camel.apache.org
Subject: camel - xml

Hi,

I am having xml data like 

<results>
	<row>
		<EMPNO>7369</EMPNO>
		<ENAME>SMITH</ENAME>
		<SAL>800</SAL>
		<DEPTNO>10</DEPTNO>
	</row>
	<row>
		<EMPNO>7499</EMPNO>
		<ENAME>SMITH></ENAME>
		<SAL>1600</SAL>
		<DEPTNO>20</DEPTNO>
	</row>
	<row>
		<EMPNO>7521</EMPNO>
		<ENAME>SMITH</ENAME>
		<SAL>1250</SAL>
		<DEPTNO>30</DEPTNO>
	</row>
	<row>
		<EMPNO>7566</EMPNO>
		<ENAME>SMITH</ENAME>
		<SAL>2975</SAL>
		<DEPTNO>20</DEPTNO>
	</row>
</results>


I am writing  a camel router like,

from("file:C://Sri/?fileName=table_export_new.xml").
		//to("file:C://Sri/table_export_new.xml").
		setHeader("results", xpath("/row/EMPNO/text()), String.class")).
		setHeader("results", xpath("/row/ENAME/text()), String.class")).
		setHeader("results", xpath("/row/SAL/text()), String.class")).
		setHeader("results", xpath("/row/DEPTNO/text()), String.class"))
	//.convertBodyTo(String.class)
		.end();

And i am getting error as 

org.apache.camel.builder.xml.InvalidXPathExpression: Invalid
xpath:/row/EMPNO/text()), String.class. Reason:
javax.xml.xpath.XPathExpressionException

Can you please help me on this?

After this i want to put the data into database as well.

Please 




--
View this message in context: http://camel.465427.n5.nabble.com/camel-xml-tp5759622.html
Sent from the Camel - Users mailing list archive at Nabble.com.