Use XPATH in Condition Expression


I am calling a HTTP service that returns XML and want to make a decision based on the returned XML in a “Flow Condition”.

I am currently doing something like

${ == 1}

where mirrors the structure of my XML response ( the corresponding xPath would be /results/head/total-hits )

Am I able to use xPath in a flow condition, or does the UEL allow me to interrogate XML? Or do I need to drop in to Java to evaluate this?

Thanks in advance


I don’t believe XPath is built in, but it should be fairly straightforward to add some support by registering a custom expression function


Thanks Will

If I can just broaden the question, what would be the normal process by which you’d call a service returning XML and parse the results? I’ve written a Java delegate to do this, but it seems like this is a fairly routine process so I feel that I must be missing something. I just want to look in the XML and use text value of an element in a condition, and the value of an attribute in a subsequent call to a different HTTP service.


There is support for JSON result handling (which most REST api these days return) like that. But not for XML (it would be a nice contribution :wink: )

I also want to achieve such a thing. I will first try to convert xml to json and then let flowable json support to handle the json. But I have doubts such as xmls with namespaces may behave strangely when it comes to converting to json. Give a try and let us know :slight_smile: