0

I am trying to avoid making a XML to JAXB transformation due to performance issues - the message can be fairly complex.

Is it possible to use expressions against message not converted to POJO?

I've tried using XML to DOM transformer but afterwards using an expression on payload results in exception ("No property ... in ...xerces.DocumentImpl")

Erwin Bolwidt
  • 30,799
  • 15
  • 56
  • 79
huksley
  • 127
  • 1
  • 7
  • Yes, in principle this is possible. If you provide a little more information perhaps we can help you get your expression working: 1. What is the type of the payload you are starting with? byte[]? String? 2. What is an example expression you're trying to evaluate? is it xpath? – Ryan Hoegg Sep 12 '14 at 15:30

1 Answers1

1

Yes. You can use MEL on XML payloads directly without transforming them to POJO.

Examples:

#[xpath('//ns:Employee/ns:LastName').text]  returns the Text inside the element <LastName> in your Employee example.

Hope this helps.

Need more help? Post details of the what specificallyyou are looking for.

user1760178
  • 6,277
  • 5
  • 27
  • 57
  • Yes, I have a payload in string format. Can I query it with XPath? Actually I`ve tried, it seems to work partially, but I don`t understand how to declare namespace prefixes - adding xmlns will not do - results in "XPath expression uses unbound namespace prefix" – huksley Sep 16 '14 at 10:35
  • Yes it is working, if using namespace-manager in flow, namespace prefixes are correctly recognised. Next trouble is xpath('expr').text returns empty, but xpath('/path/@attr') works ok. – huksley Sep 16 '14 at 11:05