if (noOfSteps == 0) {
Object exArgs[] = { Transforms.TRANSFORM_XPATH2FILTER, "XPath" };
throw new TransformationException("xml.WrongContent", exArgs);
}
if (true) {
_filterTypes.add(FUnion);
// Set root = new HashSet(); root.add(inputDoc);
HelperNodeList root = new HelperNodeList();
root.appendChild(inputDoc);
_filterNodes.add(root);
}
for (int i = 0; i < noOfSteps; i++) {
Element xpathElement =XMLUtils.selectNode(
this._transformObject.getElement().getFirstChild(),
XPath2FilterContainer.XPathFilter2NS,
XPath2FilterContainer._TAG_XPATH2,i);
XPath2FilterContainer xpathContainer =
XPath2FilterContainer.newInstance(xpathElement,
input.getSourceURI());
if (xpathContainer.isIntersect()) {
_filterTypes.add(FIntersect);
} else if (xpathContainer.isSubtract()) {
_filterTypes.add(FSubtract);
} else if (xpathContainer.isUnion()) {
_filterTypes.add(FUnion);
} else {
_filterTypes.add(null);
}
NodeList subtreeRoots = xPathFuncHereAPI.selectNodeList(inputDoc,
xpathContainer.getXPathFilterTextNode(),
CachedXPathFuncHereAPI.getStrFromNode(xpathContainer.getXPathFilterTextNode()),
xpathContainer.getElement());
// _filterNodes.add(XMLUtils.convertNodelistToSet(subtreeRoots));
_filterNodes.add(subtreeRoots);
}
this._F = new HashSet();
this._ancestors = new ArrayList();
this.traversal(inputDoc);
Set resultSet = new HashSet();
Iterator it = this._inputSet.iterator();
while (it.hasNext()) {
Object n = it.next();
if (this._F.contains(n)) {
resultSet.add(n);
}
}
XMLSignatureInput result = new XMLSignatureInput(resultSet);
result.setSourceURI(input.getSourceURI());
return result;
} catch (TransformerException ex) {
throw new TransformationException("empty", ex);
} catch (DOMException ex) {
throw new TransformationException("empty", ex);
} catch (IOException ex) {
throw new TransformationException("empty", ex);
} catch (CanonicalizationException ex) {
throw new TransformationException("empty", ex);
} catch (InvalidCanonicalizerException ex) {
throw new TransformationException("empty", ex);
} catch (ParserConfigurationException ex) {
throw new TransformationException("empty", ex);
} catch (XMLSecurityException ex) {
throw new TransformationException("empty", ex);
} catch (SAXException ex) {
throw new TransformationException("empty", ex);
}
}