I have a sample response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<trk:TrackResponse xmlns:trk="somens1">
<common:Response xmlns:common="somens2">
<common:ResponseStatus>
<common:Code>1</common:Code>
<common:Description>Success</common:Description>
</common:ResponseStatus>
<common:TransactionReference>
<common:CustomerContext>Sample Response</common:CustomerContext>
</common:TransactionReference>
</common:Response>
</trk:TrackResponse>
</soapenv:Body>
</soapenv:Envelope>
I want to remove the Envelope
, Header
and Body
tags and use only the xml beginning from TrackResponse
.
I am trying to traverse the response using jdom
.
Element body = jdom.getRootElement().getChild("Body", Namespace.getNamespace("http://schemas.xmlsoap.org/soap/envelope/"));
I actually need a jdom Document
object retrieved from the jdom Element
starting from TrackResponse
.
Solution or better alternatives?