public class C14NImpl
extends java.lang.Object
Internal use only. Class implementing XML-C14N (RFC 3076 Canonical XML Version 1.0) and Exclusive XML-C14N, with and without comments processing.
Modifier and Type | Class and Description |
---|---|
protected static class |
C14NImpl.AttrComparator
Internal use only.
|
protected static class |
C14NImpl.NSComparator
Internal use only.
|
protected static class |
C14NImpl.NSPrefixComparator
Internal use only.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.StringBuffer |
output
The output buffer in which the generated canonical representation is stored.
|
Modifier | Constructor and Description |
---|---|
protected |
C14NImpl()
Creates a C14NImpl object with comments parsing and exclusive canonicalization turned off.
|
protected |
C14NImpl(boolean withComments)
Creates a C14NImpl object with exclusive canonicalization turned off.
|
protected |
C14NImpl(boolean withComments, boolean exclusiveMode)
Creates a C14NImpl object.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
canonicalize(java.util.Collection source)
Returns the canonical octets for the given input node-set.
|
protected byte[] |
canonicalize(org.xml.sax.InputSource source)
Parses the XML in the given
InputSource and returns the canonical octets. |
protected byte[] |
canonicalize(java.io.InputStream source)
Parses the XML in the given input stream and returns the canonical octets.
|
protected byte[] |
canonicalize(java.io.InputStream source, java.lang.String systemId)
Parses the XML in the given input stream and returns the canonical octets.
|
protected byte[] |
canonicalize(org.w3c.dom.Node source)
Returns the canonical octets for the document sub-tree rooted in the given node.
|
protected byte[] |
canonicalize(org.w3c.dom.NodeList source)
Returns the canonical octets for the given input node-set.
|
protected static java.util.SortedMap |
getAncestorXMLAttrs(org.w3c.dom.Element element)
Returns a table of attributes in the XML namespace (e.g.,
xml:space="preserve" ) that should be inherited by the given element if its parent node is not in the input node-set. |
protected static boolean |
isEmptyDefaultNS(org.jaxen.dom.NamespaceNode nsNode)
Returns
true if the given namespace node is the empty default namespace, xmlns="" ; otherwise returns false . |
static boolean |
isRelativeNS(java.lang.String nsURI) |
protected static boolean |
isXMLNamespaceDecl(org.jaxen.dom.NamespaceNode nsNode)
Returns
true if the given namespace node is the XML namespace, xmlns:xml="http://www.w3.org/XML/1998/namespace" ; otherwise returns false . |
protected void |
processAttribute(org.w3c.dom.Attr attr)
Processes
org.w3c.dom.Attribute nodes, and stores the result in the output buffer. |
protected void |
processChildAxis(org.w3c.dom.Node node, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes)
Processes child axis of the given node and stores the result in the
output buffer. |
protected void |
processComment(org.w3c.dom.Comment comment)
Processes
org.w3c.dom.Comment nodes, and stores the result in the output buffer. |
protected void |
processDocument(org.w3c.dom.Document doc)
Processes
org.w3c.dom.Document nodes (which consists of processing the node's child axis) and stores the result in the output buffer. |
protected void |
processElement(org.w3c.dom.Element element, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes)
Processes
org.w3c.dom.Element nodes, (which consists of processing its namespace, attribute and child axes) and stores the result in the output buffer. |
protected void |
processNamespace(org.jaxen.dom.NamespaceNode ns)
Processes
org.w3c.dom.Namespace nodes, and stores the result in the output buffer. |
protected void |
processNode(org.w3c.dom.Node node, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes)
Generates the canonical representation of the given input node, and stores it in the
output buffer. |
protected void |
processNodeSet(java.util.Set nodeset)
Generates the canonical representation of the given input node-set, and stores it in the
output buffer. |
protected void |
processNonXPathNode(org.w3c.dom.Node node)
Processes any instance of
org.w3c.dom.Node that is not represented in the XPath 1.0 data mode; outputs nothing. |
protected void |
processPI(org.w3c.dom.ProcessingInstruction pi)
Processes
org.w3c.dom.ProcessingInstruction nodes, and stores the result in the output buffer. |
protected void |
processText(org.w3c.dom.Text text)
Processes
org.w3c.dom.Text nodes, and stores the result in the output buffer. |
protected void |
setInclusiveNamespacePrefixList(java.lang.String list)
For Exclusive C14N only: Sets the namespace prefixes that will not be treated as exclusive.
|
protected java.lang.StringBuffer output
oracle.security.crypto.util.Utils.toUTF8(output.toString())
.protected C14NImpl()
protected C14NImpl(boolean withComments)
withComments
- If true
, comments will be included.protected C14NImpl(boolean withComments, boolean exclusiveMode)
withComments
- If true
, comments will be included.exclusiveMode
- If true
, exclusive canonicalization will be performed.protected void setInclusiveNamespacePrefixList(java.lang.String list)
C14NImpl
to Exclusive C14N.list
- A whitespace-separated list of prefixes.protected byte[] canonicalize(java.io.InputStream source) throws CanonicalizationException
CanonicalizationException
protected byte[] canonicalize(java.io.InputStream source, java.lang.String systemId) throws CanonicalizationException
CanonicalizationException
protected byte[] canonicalize(org.xml.sax.InputSource source) throws CanonicalizationException
InputSource
and returns the canonical octets.CanonicalizationException
protected byte[] canonicalize(org.w3c.dom.NodeList source) throws CanonicalizationException
CanonicalizationException
protected byte[] canonicalize(java.util.Collection source) throws CanonicalizationException
CanonicalizationException
protected byte[] canonicalize(org.w3c.dom.Node source) throws CanonicalizationException
CanonicalizationException
protected void processNodeSet(java.util.Set nodeset) throws CanonicalizationException
output
buffer.CanonicalizationException
protected void processNode(org.w3c.dom.Node node, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes) throws CanonicalizationException
output
buffer.node
- The node to be processed. If node
is an element, it's namespace, attribute and child axes will also be processed.inScopeNamespaces
- A table of namespace nodes that are in scope for the given node. The SortedMap
must use an instance of C14NImpl.NSComparator
, and the contained namespace nodes serve as both keys and values.xmlAttributes
- A table of attribute nodes in the XML namespace (e.g., xml:space="preserve"
), that should be inherited by the given node if its parent is not in the input node-set. The keys in the table consist of the attribute names and the values are the attribute nodes. See getAncestorXMLAttrs(org.w3c.dom.Element)
.CanonicalizationException
processAttribute(org.w3c.dom.Attr)
, processComment(org.w3c.dom.Comment)
, processDocument(org.w3c.dom.Document)
, processElement(org.w3c.dom.Element, java.util.SortedMap, java.util.SortedMap)
, processNamespace(org.jaxen.dom.NamespaceNode)
, processNonXPathNode(org.w3c.dom.Node)
, processPI(org.w3c.dom.ProcessingInstruction)
, processText(org.w3c.dom.Text)
protected void processNonXPathNode(org.w3c.dom.Node node)
org.w3c.dom.Node
that is not represented in the XPath 1.0 data mode; outputs nothing.protected void processDocument(org.w3c.dom.Document doc) throws CanonicalizationException
org.w3c.dom.Document
nodes (which consists of processing the node's child axis) and stores the result in the output
buffer.protected void processPI(org.w3c.dom.ProcessingInstruction pi)
org.w3c.dom.ProcessingInstruction
nodes, and stores the result in the output
buffer.protected void processComment(org.w3c.dom.Comment comment)
org.w3c.dom.Comment
nodes, and stores the result in the output
buffer.protected void processText(org.w3c.dom.Text text)
org.w3c.dom.Text
nodes, and stores the result in the output
buffer.protected void processAttribute(org.w3c.dom.Attr attr)
org.w3c.dom.Attribute
nodes, and stores the result in the output
buffer.protected void processNamespace(org.jaxen.dom.NamespaceNode ns) throws CanonicalizationException
org.w3c.dom.Namespace
nodes, and stores the result in the output
buffer.CanonicalizationException
protected void processElement(org.w3c.dom.Element element, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes) throws CanonicalizationException
org.w3c.dom.Element
nodes, (which consists of processing its namespace, attribute and child axes) and stores the result in the output
buffer.element
- The element node to be processed.inScopeNamespaces
- A table of namespace nodes that are in scope for the given element. The SortedMap
must use an instance of C14NImpl.NSComparator
, and the contained namespace nodes serve as both keys and values.xmlAttributes
- A table of attribute nodes in the XML namespace (e.g., xml:space="preserve"
), that should be inherited by the given element if its parent is not in the input node-set. The keys in the table consist of the attribute names and the values are the attribute nodes. See getAncestorXMLAttrs(org.w3c.dom.Element)
.CanonicalizationException
processChildAxis(org.w3c.dom.Node, java.util.SortedMap, java.util.SortedMap)
protected void processChildAxis(org.w3c.dom.Node node, java.util.SortedMap inScopeNamespaces, java.util.SortedMap xmlAttributes) throws CanonicalizationException
output
buffer.node
- The node whose children are to be processed.inScopeNamespaces
- A table of namespace nodes that are in scope for the given node. The SortedMap
must use an instance of C14NImpl.NSComparator
, and the contained namespace nodes serve as both keys and values.xmlAttributes
- A table of attribute nodes in the XML namespace (e.g., xml:space="preserve"
), that should be inherited by the given node if its parent is not in the input node-set. The keys in the table consist of the attribute names and the values are the attribute nodes. See getAncestorXMLAttrs(org.w3c.dom.Element)
.CanonicalizationException
protected static boolean isEmptyDefaultNS(org.jaxen.dom.NamespaceNode nsNode)
true
if the given namespace node is the empty default namespace, xmlns=""
; otherwise returns false
.protected static boolean isXMLNamespaceDecl(org.jaxen.dom.NamespaceNode nsNode)
true
if the given namespace node is the XML namespace, xmlns:xml="http://www.w3.org/XML/1998/namespace"
; otherwise returns false
.public static boolean isRelativeNS(java.lang.String nsURI)
protected static java.util.SortedMap getAncestorXMLAttrs(org.w3c.dom.Element element)
xml:space="preserve"
) that should be inherited by the given element if its parent node is not in the input node-set.