org.apache.xml.security.c14n.implementations
Class CanonicalizerBase

java.lang.Object
  extended by org.apache.xml.security.c14n.CanonicalizerSpi
      extended by org.apache.xml.security.c14n.implementations.CanonicalizerBase
Direct Known Subclasses:
Canonicalizer11, Canonicalizer20010315, Canonicalizer20010315Excl, CanonicalizerPhysical

public abstract class CanonicalizerBase
extends CanonicalizerSpi

Abstract base class for canonicalization algorithms.

Author:
Christian Geuer-Pollmann

Field Summary
protected static AttrCompare COMPARE
           
protected static int NODE_AFTER_DOCUMENT_ELEMENT
           
protected static int NODE_BEFORE_DOCUMENT_ELEMENT
           
protected static int NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT
           
static String XML
           
static String XMLNS
           
 
Fields inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
reset, secureValidation
 
Constructor Summary
CanonicalizerBase(boolean includeComments)
          Constructor CanonicalizerBase
 
Method Summary
protected  void canonicalizeSubTree(Node currentNode, NameSpaceSymbTable ns, Node endnode, int documentLevel)
          Method canonicalizeSubTree, this function is a recursive one.
protected  void canonicalizeXPathNodeSet(Node currentNode, Node endnode)
          Canonicalizes all the nodes included in the currentNode and contained in the xpathNodeSet field.
 byte[] engineCanonicalize(XMLSignatureInput input)
          Canonicalizes a Subtree node.
 byte[] engineCanonicalizeSubTree(Node rootNode)
          Method engineCanonicalizeSubTree
protected  byte[] engineCanonicalizeSubTree(Node rootNode, Node excludeNode)
          Canonicalizes a Subtree node.
 byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
          Method engineCanonicalizeXPathNodeSet
protected  Attr getNullNode(Document ownerDocument)
           
protected  void getParentNameSpaces(Element el, NameSpaceSymbTable ns)
          Adds to ns the definitions from the parent elements of el
protected  void handleParent(Element e, NameSpaceSymbTable ns)
           
protected  boolean isVisible(Node currentNode)
           
protected  int isVisibleDO(Node currentNode, int level)
           
protected  int isVisibleInt(Node currentNode)
           
protected static void outputAttrToWriter(String name, String value, OutputStream writer, Map<String,byte[]> cache)
          Outputs an Attribute to the internal Writer.
protected  void outputCommentToWriter(Comment currentComment, OutputStream writer, int position)
          Method outputCommentToWriter
protected  void outputPItoWriter(ProcessingInstruction currentPI, OutputStream writer, int position)
          Outputs a PI to the internal Writer.
protected static void outputTextToWriter(String text, OutputStream writer)
          Outputs a Text of CDATA section to the internal Writer.
 void setWriter(OutputStream writer)
          Sets the writer where the canonicalization ends.
 
Methods inherited from class org.apache.xml.security.c14n.CanonicalizerSpi
engineCanonicalize, engineCanonicalizeSubTree, engineCanonicalizeSubTree, engineCanonicalizeXPathNodeSet, engineCanonicalizeXPathNodeSet, engineCanonicalizeXPathNodeSet, engineGetIncludeComments, engineGetURI, isSecureValidation, setSecureValidation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML

public static final String XML
See Also:
Constant Field Values

XMLNS

public static final String XMLNS
See Also:
Constant Field Values

COMPARE

protected static final AttrCompare COMPARE

NODE_BEFORE_DOCUMENT_ELEMENT

protected static final int NODE_BEFORE_DOCUMENT_ELEMENT
See Also:
Constant Field Values

NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT

protected static final int NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT
See Also:
Constant Field Values

NODE_AFTER_DOCUMENT_ELEMENT

protected static final int NODE_AFTER_DOCUMENT_ELEMENT
See Also:
Constant Field Values
Constructor Detail

CanonicalizerBase

public CanonicalizerBase(boolean includeComments)
Constructor CanonicalizerBase

Parameters:
includeComments -
Method Detail

engineCanonicalizeSubTree

public byte[] engineCanonicalizeSubTree(Node rootNode)
                                 throws CanonicalizationException
Method engineCanonicalizeSubTree

Specified by:
engineCanonicalizeSubTree in class CanonicalizerSpi
Parameters:
rootNode -
Returns:
the c14n bytes
Throws:
CanonicalizationException

engineCanonicalizeXPathNodeSet

public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
                                      throws CanonicalizationException
Method engineCanonicalizeXPathNodeSet

Specified by:
engineCanonicalizeXPathNodeSet in class CanonicalizerSpi
Parameters:
xpathNodeSet -
Returns:
the c14n bytes
Throws:
CanonicalizationException

engineCanonicalize

public byte[] engineCanonicalize(XMLSignatureInput input)
                          throws CanonicalizationException
Canonicalizes a Subtree node.

Parameters:
input - the root of the subtree to canicalize
Returns:
The canonicalize stream.
Throws:
CanonicalizationException

setWriter

public void setWriter(OutputStream writer)
Description copied from class: CanonicalizerSpi
Sets the writer where the canonicalization ends. ByteArrayOutputStream if none is set.

Specified by:
setWriter in class CanonicalizerSpi
Parameters:
writer - The writer to set.

engineCanonicalizeSubTree

protected byte[] engineCanonicalizeSubTree(Node rootNode,
                                           Node excludeNode)
                                    throws CanonicalizationException
Canonicalizes a Subtree node.

Parameters:
rootNode - the root of the subtree to canonicalize
excludeNode - a node to be excluded from the canonicalize operation
Returns:
The canonicalize stream.
Throws:
CanonicalizationException

canonicalizeSubTree

protected final void canonicalizeSubTree(Node currentNode,
                                         NameSpaceSymbTable ns,
                                         Node endnode,
                                         int documentLevel)
                                  throws CanonicalizationException,
                                         IOException
Method canonicalizeSubTree, this function is a recursive one.

Parameters:
currentNode -
ns -
endnode -
Throws:
CanonicalizationException
IOException

canonicalizeXPathNodeSet

protected final void canonicalizeXPathNodeSet(Node currentNode,
                                              Node endnode)
                                       throws CanonicalizationException,
                                              IOException
Canonicalizes all the nodes included in the currentNode and contained in the xpathNodeSet field.

Parameters:
currentNode -
endnode -
Throws:
CanonicalizationException
IOException

isVisibleDO

protected int isVisibleDO(Node currentNode,
                          int level)

isVisibleInt

protected int isVisibleInt(Node currentNode)

isVisible

protected boolean isVisible(Node currentNode)

handleParent

protected void handleParent(Element e,
                            NameSpaceSymbTable ns)

getParentNameSpaces

protected final void getParentNameSpaces(Element el,
                                         NameSpaceSymbTable ns)
Adds to ns the definitions from the parent elements of el

Parameters:
el -
ns -

outputAttrToWriter

protected static final void outputAttrToWriter(String name,
                                               String value,
                                               OutputStream writer,
                                               Map<String,byte[]> cache)
                                        throws IOException
Outputs an Attribute to the internal Writer. The string value of the node is modified by replacing

Parameters:
name -
value -
writer -
Throws:
IOException

outputPItoWriter

protected void outputPItoWriter(ProcessingInstruction currentPI,
                                OutputStream writer,
                                int position)
                         throws IOException
Outputs a PI to the internal Writer.

Parameters:
currentPI -
writer - where to write the things
Throws:
IOException

outputCommentToWriter

protected void outputCommentToWriter(Comment currentComment,
                                     OutputStream writer,
                                     int position)
                              throws IOException
Method outputCommentToWriter

Parameters:
currentComment -
writer - writer where to write the things
Throws:
IOException

outputTextToWriter

protected static final void outputTextToWriter(String text,
                                               OutputStream writer)
                                        throws IOException
Outputs a Text of CDATA section to the internal Writer.

Parameters:
text -
writer - writer where to write the things
Throws:
IOException

getNullNode

protected Attr getNullNode(Document ownerDocument)


Copyright © 2000–2014 The Apache Software Foundation. All rights reserved.