I've ran through all the methods on the dom4J Element and Node. I'm having an issue. I have a SOAP envelope with an header and a body. In the body there is a detail xml that has the type of request.
I get the body Node here correctly below.
try
{
bodyNode = myDoc.selectSingleNode("//soapenv:Envelope/soapenv:Body");
LOG.debug("bodyNode as XML : " + bodyNode.asXML());
}
catch(Exception e)
{
LOG.debug("Cant find bodyNode : ", e);
}
If I do the asXML() method I get.
<SOAP-ENV:Body>
<IdentifyMember xmlns="http://soa.com/IdentificationService/">
<IdentifyMemberRequest xmlns="http://soa.com/IdentificationService/">
<FirstName xmlns="http://soa.com/IdentifyRequestSchema">= John</FirstName>
<LastName xmlns="http://soa.com/IdentifyRequestSchema">= Smith</LastName>
</IdentifyMemberRequest>
</IdentifyMember>
</SOAP-ENV:Body>
This is correct. But I need to just get any xml between the body. For instance in this one I want the entire IdentifyMember element. I don't want to use index and substring and all of that. I was assuming there was already a method that would return me the following in either the Node or the Element. And I don't know what is coming in between those body tags so it has to be generic. Any Ideas?
<IdentifyMember xmlns="http://soa.com/IdentificationService/">
<IdentifyMemberRequest xmlns="http://soa.com/IdentificationService/">
<FirstName xmlns="http://soa.com/IdentifyRequestSchema">= John</FirstName>
<LastName xmlns="http://soa.com/IdentifyRequestSchema">= Smith</LastName>
</IdentifyMemberRequest>
</IdentifyMember>