camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Castyn <>
Subject Re: Custom Processor with XPath
Date Tue, 22 Nov 2011 16:02:19 GMT
Good to know.  I have the body properly converting to a Document now.

I suppose this may end up more of an XPath question, so I apologize in
advance but I have looked everywhere for some complicated examples and
haven't had much luck.

Let's say this is the document that is coming into my custom processor and
being converted to a Document:

<soap:Envelope xmlns:soap="">
				<language isoCountryCode="US" isoLanguageCode="en" /> 
				<headerVersion build="" major="1" minor="0" /> 
				<transactionStatus overallStatusArea="HOTELCONTENT"
overallStatusCode="0000" overallStatusDescription="OK"
transactionSuccessful="true" /> 
				<serviceTransactionDuration endTime="2011-11-21T11:21:46.906-05:00"
startTime="2011-11-21T11:21:46.390-05:00" /> 
				<ns4:contentList attributeNumber="718" name="Airport Details">
					<ns4:compound attributeId="1390159538" attributeNumber="718"
name="Airport Details" valueChangeDate="2009-07-01T04:00:00.000">
						<ns4:textLine attributeId="1390159539" attributeNumber="719"
name="Airport Code" valueChangeDate="2009-07-01T04:00:00.000">
					<ns4:compound attributeId="1390159538" attributeNumber="718"
name="Airport Details" valueChangeDate="2009-07-01T04:00:00.000">
						<ns4:textLine attributeId="462364234" attributeNumber="719"
name="Airport Code" valueChangeDate="2009-07-01T04:00:00.000">

I am trying to get a Node List of the airport codes (in this doc ATL and
NYC).  What I have been trying is 

XPath xpath = XPathFactory.newInstance().newXPath();		
XPathExpression expr = xpath.compile("//textLine[attributeNumber='719']");
NodeList nodes = (NodeList)expr.evaluate(payload, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
   // Do Stuff

I am not sure if the document needs to have other information attached to it
such as XML version for xpath to treat it properly or if it is something
else, but I haven't been able to get any nodes returned at all on the
document, even when trying expressions as simple as "//hotelContent" and
such.  Is there something I am missing?

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message