Module org.apache.santuario.xmlsec
Class Canonicalizer20010315
- java.lang.Object
-
- org.apache.xml.security.c14n.CanonicalizerSpi
-
- org.apache.xml.security.c14n.implementations.CanonicalizerBase
-
- org.apache.xml.security.c14n.implementations.Canonicalizer20010315
-
- Direct Known Subclasses:
Canonicalizer11_OmitComments,Canonicalizer11_WithComments,Canonicalizer20010315OmitComments,Canonicalizer20010315WithComments
public abstract class Canonicalizer20010315 extends CanonicalizerBase
Implements Canonical XML Version 1.0, a W3C Recommendation from 15 March 2001.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanc14n11private booleanfirstCallprivate XmlAttrStackxmlattrStack-
Fields inherited from class org.apache.xml.security.c14n.implementations.CanonicalizerBase
COMPARE, NODE_AFTER_DOCUMENT_ELEMENT, NODE_BEFORE_DOCUMENT_ELEMENT, NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT, XML, XML_LANG_URI, XMLNS, XMLNS_URI
-
-
Constructor Summary
Constructors Constructor Description Canonicalizer20010315(boolean includeComments)Constructor Canonicalizer20010315Canonicalizer20010315(boolean includeComments, boolean c14n11)Constructor Canonicalizer20010315
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcircumventBugIfNeeded(XMLSignatureInput input)voidengineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces, boolean propagateDefaultNamespace, java.io.OutputStream writer)Always throws a CanonicalizationException because this is inclusive c14n.voidengineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces, java.io.OutputStream writer)Always throws a CanonicalizationException because this is inclusive c14n.voidengineCanonicalizeXPathNodeSet(java.util.Set<org.w3c.dom.Node> xpathNodeSet, java.lang.String inclusiveNamespaces, java.io.OutputStream writer)Always throws a CanonicalizationException because this is inclusive c14n.protected voidhandleParent(org.w3c.dom.Element e, NameSpaceSymbTable ns)protected voidoutputAttributes(org.w3c.dom.Element element, NameSpaceSymbTable ns, java.util.Map<java.lang.String,byte[]> cache, java.io.OutputStream writer)Output the Attr[]s for the given element.protected voidoutputAttributesSubtree(org.w3c.dom.Element element, NameSpaceSymbTable ns, java.util.Map<java.lang.String,byte[]> cache, java.io.OutputStream writer)Output the Attr[]s for the given element.-
Methods inherited from class org.apache.xml.security.c14n.implementations.CanonicalizerBase
engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, getNullNode, isVisible, isVisibleDO, isVisibleInt, outputAttrToWriter, outputCommentToWriter, outputPItoWriter
-
Methods inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize, engineGetURI
-
-
-
-
Field Detail
-
firstCall
private boolean firstCall
-
xmlattrStack
private final XmlAttrStack xmlattrStack
-
c14n11
private final boolean c14n11
-
-
Constructor Detail
-
Canonicalizer20010315
public Canonicalizer20010315(boolean includeComments)
Constructor Canonicalizer20010315- Parameters:
includeComments-
-
Canonicalizer20010315
public Canonicalizer20010315(boolean includeComments, boolean c14n11)Constructor Canonicalizer20010315- Parameters:
includeComments-c14n11- Whether this is a Canonical XML 1.1 implementation or not
-
-
Method Detail
-
engineCanonicalizeXPathNodeSet
public void engineCanonicalizeXPathNodeSet(java.util.Set<org.w3c.dom.Node> xpathNodeSet, java.lang.String inclusiveNamespaces, java.io.OutputStream writer) throws CanonicalizationExceptionAlways throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeXPathNodeSetin classCanonicalizerSpi- Parameters:
xpathNodeSet-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException- always
-
engineCanonicalizeSubTree
public void engineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces, java.io.OutputStream writer) throws CanonicalizationExceptionAlways throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-inclusiveNamespaces-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationException
-
engineCanonicalizeSubTree
public void engineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces, boolean propagateDefaultNamespace, java.io.OutputStream writer) throws CanonicalizationExceptionAlways throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-inclusiveNamespaces-writer- OutputStream to write the canonicalization resultpropagateDefaultNamespace- If true the default namespace will be propagated to the c14n-ized root element- Throws:
CanonicalizationException
-
outputAttributesSubtree
protected void outputAttributesSubtree(org.w3c.dom.Element element, NameSpaceSymbTable ns, java.util.Map<java.lang.String,byte[]> cache, java.io.OutputStream writer) throws CanonicalizationException, org.w3c.dom.DOMException, java.io.IOExceptionOutput the Attr[]s for the given element.
The code of this method is a copy ofoutputAttributes(Element, NameSpaceSymbTable, Map, OutputStream), whereas it takes into account that subtree-c14n is -- well -- subtree-based. So if the element in question isRoot of c14n, it's parent is not in the node set, as well as all other ancestors.- Specified by:
outputAttributesSubtreein classCanonicalizerBase- Parameters:
element-ns-cache-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationExceptionorg.w3c.dom.DOMExceptionjava.io.IOException
-
outputAttributes
protected void outputAttributes(org.w3c.dom.Element element, NameSpaceSymbTable ns, java.util.Map<java.lang.String,byte[]> cache, java.io.OutputStream writer) throws CanonicalizationException, org.w3c.dom.DOMException, java.io.IOExceptionOutput the Attr[]s for the given element.
IMPORTANT: This method expects to work on a modified DOM tree, i.e. a DOM which has been prepared usingXMLUtils.circumventBug2650( org.w3c.dom.Document).- Specified by:
outputAttributesin classCanonicalizerBase- Parameters:
element-ns-cache-writer- OutputStream to write the canonicalization result- Throws:
CanonicalizationExceptionorg.w3c.dom.DOMExceptionjava.io.IOException
-
circumventBugIfNeeded
protected void circumventBugIfNeeded(XMLSignatureInput input) throws XMLParserException, java.io.IOException
- Specified by:
circumventBugIfNeededin classCanonicalizerBase- Throws:
XMLParserExceptionjava.io.IOException
-
handleParent
protected void handleParent(org.w3c.dom.Element e, NameSpaceSymbTable ns)- Overrides:
handleParentin classCanonicalizerBase
-
-