public class Canonicalizer extends Object
The Canonicalizer is initialized using an
Iterator that MUST provide the Nodes of
the input node-set in document order (according to XML Path Language
(XPath) Version 1.0, Section 5) with the following weakening: The order
of the namespace and attribute child nodes of an element may be arbitrary.
This Canonicalizer examines only the nodes in the input node-set
(the nodes provided by the Iterator) and their
ancestor-elements. No node is examined twice, as a stack is used to keep
track of the ancestor-elements of each node in the input node-set. Therefore,
the elements have to be provided in document order.
This Canonicalizer supports stream processing as
processNextNode() processes the next node provided by the
Iterator. The returned byte[] may be empty as long
as further nodes of the input node-set have to be processed to be able to
render a corresponding canonicalization result.
Use a CanonInputStream to implement
streaming behaviour.
CanonInputStream| Constructor and Description |
|---|
Canonicalizer(Iterator nodeIterator,
boolean withComments,
boolean exclusive,
boolean c14n11,
List inclusiveNSPrefixes)
Creates a
Canonicalizer. |
Canonicalizer(Iterator nodeIterator,
boolean withComments,
boolean exclusive,
List inclusiveNSPrefixes)
Creates a
Canonicalizer. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
processNextNode()
|
static void |
setBackToCompatibilityPrior1_13()
There has been a bug in XSECT prior to 1.13 that caused a wrong
canonicalization result when tabs '#x9' or line breaks '#xA' where used in
an attribute.
|
public Canonicalizer(Iterator nodeIterator, boolean withComments, boolean exclusive, List inclusiveNSPrefixes)
Canonicalizer.nodeIterator - that MUST provide the Nodes of the input node-set in
document orderwithComments - true if canonicalization with comments is should be
used, or false otherwiseexclusive - true if Exclusive XML
Canonicalization Version 1.0 should be used, false
if Canonical XML
Version 1.0 should be usedinclusiveNSPrefixes - a list of namespace prefixes (Strings) that should be
canonicalized according to Canonical XML
when using Exclusive XML
Canonicalization . (must be null if
exclusive is false.public Canonicalizer(Iterator nodeIterator, boolean withComments, boolean exclusive, boolean c14n11, List inclusiveNSPrefixes)
Canonicalizer.nodeIterator - that MUST provide the Nodes of the input node-set in
document orderwithComments - true if canonicalization with comments is should be
used, or false otherwiseexclusive - true if Exclusive XML
Canonicalization Version 1.0 should be used, false
if Canonical XML
Version 1.0 should be usedc14n11 - This is to support C14n 1.1 (experimental).inclusiveNSPrefixes - a list of namespace prefixes (Strings) that should be
canonicalized according to Canonical XML
when using Exclusive XML
Canonicalization . (must be null if
exclusive is false.public static void setBackToCompatibilityPrior1_13()
public byte[] processNextNode()
Nodeof the input node-set provided by the
Iteratorused to initialize this Canonicalizer. Returns
a byte[] containing the result of rendering the next node of
the input-node set. The returned byte[] may be empty until
enough nodes of the input node-set have been processed to render a
corresponding binary representation (e.g. the start-tag of an element is
rendered not before all namespace and attribute children of this element
have been processed). Returns null after the last node of the
input node-set has been processed and no further output by the
canonicalizer is produced.byte[] containing the result of processing the next
node of the input node-set (may be empty), or null
after the processing of the last node of the input node-set© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC