Strange XPath behaviour using xpath-transformer - tags lost
I'm just trying to understand the different behaviour between a xpath-splitter and a xpath-transformer
I have a requirement where I need to extract the inner part of message (as the xml payload I need is wrapped in an another xml document that has an xs:any node)
abbreviated example (with namespaces omitted)
So initially I thought 'xpath-transformer' would do the job. But the result is the Payload contains a String with the textual values of the nested document, but no tags are present around the data - just empty spaces where tags should be :-
<!-- nested document starts here -->
So note: this is using
however if instead I choose
then the Payload result is of Type: DeferredElementNSImpl which if logged shows: [payload: null]
which I assume is no good to the next step in my processing - which is an xml unmarshall.
So given this was not working I instead tried an xpath-splitter :-
This seems to work fine, the resulting payload is a String, however I'm not that happy with the solution as a splitter feels wrong - as I'm only splitting into 1 item, so it's really a transformation thats required.
What I did deduce is that when a xpath-splitter is used the spring code will do a :-
in the splitDocument() method of the XPathMessageSplitter which seems to do the trick.
transformer.transform(new DOMSource(nodeFromList), result);
Any thoughts on what's going on ?