cat.debug("perform xfilter2 on " + inputSet.size() + " nodes");
CachedXPathFuncHereAPI xPathFuncHereAPI =
new CachedXPathFuncHereAPI(input.getCachedXPathAPI());
CachedXPathAPI myXPathAPI =
new CachedXPathAPI(input.getCachedXPathAPI());
if (inputSet.size() == 0) {
Object exArgs[] = { "input node set contains no nodes" };
throw new TransformationException("empty", exArgs);
}
Element xpathElement =
this._transformObject.getChildElementLocalName(0,
XPath2FilterContainer04.XPathFilter2NS,
XPath2FilterContainer04._TAG_XPATH2);
if (xpathElement == null) {
Object exArgs[] = { "dsig-xpath:XPath", "Transform" };
throw new TransformationException("xml.WrongContent", exArgs);
}
Document inputDoc = null;
{
Iterator it = inputSet.iterator();
if (it.hasNext()) {
inputDoc = XMLUtils.getOwnerDocument((Node) it.next());
}
}
XPath2FilterContainer04 xpathContainer =
XPath2FilterContainer04.newInstance(xpathElement,
input.getSourceURI());
Document doc = this._transformObject.getElement().getOwnerDocument();
NodeList subtreeRoots = xPathFuncHereAPI.selectNodeList(doc,
xpathContainer.getXPathFilterTextNode(),
xpathContainer.getElement());
cat.debug("subtreeRoots contains " + subtreeRoots.getLength()
+ " nodes");
/*
* foreach subtree
*/
Set selectedNodes = new HashSet();
for (int i = 0; i < subtreeRoots.getLength(); i++) {
Node currentRootNode = subtreeRoots.item(i);
int currentRootNodeType = currentRootNode.getNodeType();
if ((currentRootNodeType == Node.ELEMENT_NODE)
|| (currentRootNodeType == Node.DOCUMENT_NODE)) {
NodeList nodesInSubtree =
myXPathAPI
.selectNodeList(currentRootNode, Canonicalizer
.XPATH_C14N_WITH_COMMENTS_SINGLE_NODE);
int jMax = nodesInSubtree.getLength();
for (int j = 0; j < jMax; j++) {