Element soapEnvelope = soapHeader.getOwnerDocument().getDocumentElement();
if (containsXPathPolicy(aim)) {
// XPathFactory and XPath are not thread-safe so we must recreate them
// each request.
final XPathFactory factory = XPathFactory.newInstance();
final XPath xpath = factory.newXPath();
check &= assertXPathTokens(aim, SPConstants.SIGNED_ELEMENTS, signed, soapEnvelope,
CoverageType.SIGNED, CoverageScope.ELEMENT, xpath);
check &= assertXPathTokens(aim, SPConstants.ENCRYPTED_ELEMENTS, encrypted, soapEnvelope,
CoverageType.ENCRYPTED, CoverageScope.ELEMENT, xpath);