XMLSignature sig = new XMLSignature(doc, null,
XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
doc.getDocumentElement().appendChild(sig.getElement());
Transforms transforms = new Transforms(doc);
{
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04
.newInstanceIntersect(doc, "//E")
.getElement());
/*
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04.newInstanceUnion(doc,
"//B").getElement());
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04.newInstanceSubtract(doc,
"//C").getElement());
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04.newInstanceUnion(doc,
"//F").getElement());
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04.newInstanceSubtract(doc,
"//G").getElement());
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04.newInstanceUnion(doc,
"//H").getElement());
transforms.addTransform(Transforms.TRANSFORM_XPATH2FILTER04,
XPath2FilterContainer04.newInstanceSubtract(doc,
"//@x:attr").getElement());
*/
transforms.setXPathNamespaceContext("xmlns:x", "http://foo.bar/");
transforms
.setXPathNamespaceContext(Transforms
.getDefaultPrefix(Transforms
.TRANSFORM_XPATH2FILTER04), Transforms.TRANSFORM_XPATH2FILTER04);
}