I have the following xpath
expression and call to getValueByXpath
:
String xpath = "/msg:L1MessageRequest/msg:Header";
Object val = jaxbContexL1.getValueByXPath(message.getPayload(), xpath, resolver, Object.class);
I am getting null
value back from call to getValueByXPath()
method when I try to pass in an expression that should be returning an XML set of elements. For example, I should get back:
<msg:Header>
<hdr:MsgID>LA00000000000110wAA11111</hdr:MsgID>
<hdr:MsgType>request</hdr:MsgType>
<hdr:MsgTimestamp>2016-01-05T09:00:00-04:00</hdr:MsgTimestamp>
.. more stuff ...
</msg:Header>
Since I do not know what the expected return type is, I just passed in Object.class
, but not sure if that is the problem. Does anyone know what java type's class I should be using to return an XML fragment from the method? I know the expression and input XML document is correct, as I tried it with an xpath
parser directly.