Document doc = uri.getOwnerDocument();
// this must be done so that Xalan can catch ALL namespaces
XMLUtils.circumventBug2650(doc);
CachedXPathAPI cXPathAPI = new CachedXPathAPI();
if (uriNodeValue.equals("")) {
/*
* Identifies the node-set (minus any comment nodes) of the XML
* resource containing the signature
*/
// cat.debug("ResolverFragment with empty URI (means complete document)");
try {
resultNodes =
cXPathAPI.selectNodeList(doc,
Canonicalizer.XPATH_C14N_OMIT_COMMENTS);
} catch (javax.xml.transform.TransformerException ex) {
throw new ResourceResolverException("generic.EmptyMessage", ex,
uri, BaseURI);
}
} else {
/*
* URI="#chapter1"
* Identifies a node-set containing the element with ID attribute
* value 'chapter1' of the XML resource containing the signature.
* XML Signature (and its applications) modify this node-set to
* include the element plus all descendents including namespaces and
* attributes -- but not comments.
*/
String id = uriNodeValue.substring(1);
// Element selectedElem = doc.getElementById(id);
Element selectedElem = IdResolver.getElementById(doc, id);
// cat.debug("Try to catch an Element with ID " + id + " and Element was " + selectedElem);
if (selectedElem == null) {
resultNodes = new HelperNodeList();
} else {
try {
resultNodes =
cXPathAPI
.selectNodeList(selectedElem, Canonicalizer
.XPATH_C14N_OMIT_COMMENTS_SINGLE_NODE);
} catch (javax.xml.transform.TransformerException ex) {
throw new ResourceResolverException("generic.EmptyMessage", ex,
uri, BaseURI);