Class Canonicalizer11
java.lang.Object
org.docx4j.org.apache.xml.security.c14n.CanonicalizerSpi
org.docx4j.org.apache.xml.security.c14n.implementations.CanonicalizerBase
org.docx4j.org.apache.xml.security.c14n.implementations.Canonicalizer11
- Direct Known Subclasses:
Canonicalizer11_OmitComments,Canonicalizer11_WithComments
public abstract class Canonicalizer11 extends CanonicalizerBase
Implements
Canonical XML Version 1.1, a W3C Proposed Recommendation from 29
January 2008.
- Author:
- Sean Mullan, Raul Benito
-
Field Summary
Fields inherited from class org.docx4j.org.apache.xml.security.c14n.implementations.CanonicalizerBase
COMPARE, NODE_AFTER_DOCUMENT_ELEMENT, NODE_BEFORE_DOCUMENT_ELEMENT, NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT, XML, XMLNSFields inherited from class org.docx4j.org.apache.xml.security.c14n.CanonicalizerSpi
reset, secureValidation -
Constructor Summary
Constructors Constructor Description Canonicalizer11(boolean includeComments)Constructor Canonicalizer11 -
Method Summary
Modifier and Type Method Description protected voidcircumventBugIfNeeded(XMLSignatureInput input)byte[]engineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces)Always throws a CanonicalizationException because this is inclusive c14n.byte[]engineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces, boolean propagateDefaultNamespace)Always throws a CanonicalizationException because this is inclusive c14n.byte[]engineCanonicalizeXPathNodeSet(java.util.Set<org.w3c.dom.Node> xpathNodeSet, java.lang.String inclusiveNamespaces)Always throws a CanonicalizationException because this is inclusive c14n.protected java.util.Iterator<org.w3c.dom.Attr>handleAttributes(org.w3c.dom.Element element, NameSpaceSymbTable ns)Returns the Attr[]s to be output for the given element.protected java.util.Iterator<org.w3c.dom.Attr>handleAttributesSubtree(org.w3c.dom.Element element, NameSpaceSymbTable ns)Returns the Attr[]s to be output for the given element.protected voidhandleParent(org.w3c.dom.Element e, NameSpaceSymbTable ns)Methods inherited from class org.docx4j.org.apache.xml.security.c14n.implementations.CanonicalizerBase
canonicalizeSubTree, canonicalizeXPathNodeSet, engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, getNullNode, getParentNameSpaces, isVisible, isVisibleDO, isVisibleInt, outputAttrToWriter, outputCommentToWriter, outputPItoWriter, outputTextToWriter, setWriterMethods inherited from class org.docx4j.org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize, engineCanonicalizeXPathNodeSet, engineCanonicalizeXPathNodeSet, engineGetIncludeComments, engineGetURI, isSecureValidation, setSecureValidation
-
Constructor Details
-
Canonicalizer11
public Canonicalizer11(boolean includeComments)Constructor Canonicalizer11- Parameters:
includeComments-
-
-
Method Details
-
engineCanonicalizeXPathNodeSet
public byte[] engineCanonicalizeXPathNodeSet(java.util.Set<org.w3c.dom.Node> xpathNodeSet, java.lang.String inclusiveNamespaces) throws CanonicalizationExceptionAlways throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeXPathNodeSetin classCanonicalizerSpi- Parameters:
xpathNodeSet-inclusiveNamespaces-- Returns:
- none it always fails
- Throws:
CanonicalizationException- always
-
engineCanonicalizeSubTree
public byte[] engineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces) throws CanonicalizationExceptionAlways throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-inclusiveNamespaces-- Returns:
- none it always fails
- Throws:
CanonicalizationException
-
engineCanonicalizeSubTree
public byte[] engineCanonicalizeSubTree(org.w3c.dom.Node rootNode, java.lang.String inclusiveNamespaces, boolean propagateDefaultNamespace) throws CanonicalizationExceptionAlways throws a CanonicalizationException because this is inclusive c14n.- Specified by:
engineCanonicalizeSubTreein classCanonicalizerSpi- Parameters:
rootNode-inclusiveNamespaces-propagateDefaultNamespace- If true the default namespace will be propagated to the c14n-ized root element- Returns:
- none it always fails
- Throws:
CanonicalizationException
-
handleAttributesSubtree
protected java.util.Iterator<org.w3c.dom.Attr> handleAttributesSubtree(org.w3c.dom.Element element, NameSpaceSymbTable ns) throws CanonicalizationExceptionReturns the Attr[]s to be output for the given element.
The code of this method is a copy ofhandleAttributes(Element, NameSpaceSymbTable), 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.- Parameters:
element-ns-- Returns:
- the Attr[]s to be output
- Throws:
CanonicalizationException
-
handleAttributes
protected java.util.Iterator<org.w3c.dom.Attr> handleAttributes(org.w3c.dom.Element element, NameSpaceSymbTable ns) throws CanonicalizationExceptionReturns the Attr[]s to be output 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).- Parameters:
element-ns-- Returns:
- the Attr[]s to be output
- Throws:
CanonicalizationException
-
circumventBugIfNeeded
protected void circumventBugIfNeeded(XMLSignatureInput input) throws CanonicalizationException, javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException- Throws:
CanonicalizationExceptionjavax.xml.parsers.ParserConfigurationExceptionjava.io.IOExceptionorg.xml.sax.SAXException
-
handleParent
- Overrides:
handleParentin classCanonicalizerBase
-