public class XPathTransformer extends java.lang.Object implements Transformer
The input required by this transform is an XPath node-set. Note that if the actual input is an XPath node-set resulting from a null URI or shortname XPointer dereference, then comment nodes will have been omitted. If the actual input is an octet stream, then the application MUST convert the octet stream to an XPath node-set suitable for use by Canonical XML with Comments. (A subsequent application of the REQUIRED Canonical XML algorithm would strip away these comments.) In other words, the input node-set should be equivalent to the one that would be created by the following process:
The evaluation of this expression includes all of the document's nodes (including comments) in the node-set representing the octet stream.
The transform output is also an XPath node-set. The XPath expression appearing in the XPath parameter is evaluated once for each node in the input node-set. The result is converted to a boolean. If the boolean is true, then the node is included in the output node-set. If the boolean is false, then the node is omitted from the output node-set.
The primary purpose of this transform is to ensure that only specifically defined changes to the input XML document are permitted after the signature is affixed. This is done by omitting precisely those nodes that are allowed to change once the signature is affixed, and including all other input nodes in the output. It is the responsibility of the XPath expression author to include all nodes whose change could affect the interpretation of the transform output in the application context.
| Constructor and Description |
|---|
XPathTransformer() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptsAlgorithm(java.lang.String aAlgorithmURI)
Is transformer responsible for the algorithm given as parameter?
|
java.util.List<DataType> |
expectedDataTypes() |
static void |
main(java.lang.String[] args) |
DataType |
returnType() |
org.w3c.dom.NodeList |
transform(java.lang.Object aObject,
java.lang.String aAlgorithmURI,
java.lang.Object[] aParams,
org.w3c.dom.Element aElement,
java.lang.String aBaseURI)
Make the appropriate transform defined by algorithm according to
parameters
link{NodeList} |
public java.util.List<DataType> expectedDataTypes()
expectedDataTypes in interface Transformerpublic DataType returnType()
returnType in interface Transformerpublic boolean acceptsAlgorithm(java.lang.String aAlgorithmURI)
TransformeracceptsAlgorithm in interface TransformeraAlgorithmURI - algorithm URI declared in XMLdSig specpublic org.w3c.dom.NodeList transform(java.lang.Object aObject,
java.lang.String aAlgorithmURI,
java.lang.Object[] aParams,
org.w3c.dom.Element aElement,
java.lang.String aBaseURI)
throws XMLSignatureException
Transformerlink{NodeList}transform in interface TransformeraObject - object to be transformed, should be either
@link{NodeList} or @link{InputStream}
according to return type of expectedDataTypesaAlgorithmURI - algorithm defined b XMLdSig sprecaParams - algorithm parameters if anyaElement - xml element where transform is declaredaBaseURI - where to find relative resoursesDataType
declared by Transformer.returnType()XMLSignatureException - if any problem occurspublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.ExceptionCopyright © 2025. All rights reserved.