Class Canonicalize

java.lang.Object
com.adobe.xfa.service.canonicalize.Canonicalize

public class Canonicalize extends Object
A service class to canonicalize XML DOM nodes into their standard representations as defined by the invalid input: '<'a * href="http://www.w3.org/TR/xml-c14n">Canonical XML and the Exclusive XML Canonicalization specifications.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Canonicalization type: generic canonicalization.
    static final int
    Canonicalization type: generic canonicalization with all comments removed.
    static final int
    Canonicalization type: exclusive canonicalization.
    static final int
    Canonicalization type: exclusive canonicalization with all comments removed.
    static final int
    Canonicalization type: generic canonicalization without the use of context namespaces.
    static final int
    Canonicalization type: generic canonicalization without the use of context namespaces and with all comments removed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a canonicalization service.
    Canonicalize(boolean bLegacy_V32_Canonicalization)
    Instantiates a canonicalization service.
    Canonicalize(Node node, boolean bInPlace, boolean bLegacy_V32_Canonicalization)
    Instantiates a canonicalization service.
    Canonicalize(List<? extends Node> store, boolean bWithDescendants, boolean bLegacy_V32_Canonicalization)
    Instantiates a canonicalization service.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    canonicalize(int eCanonicalType, List<String> inclusiveNSPrefixList)
    Performs text normalization of a set of nodes.
    void
    canonicalize(OutputStream out, int eCanonicalType, List<String> inclusiveNSPrefixList)
    Performs text normalization of a set of nodes.
    canonicalize(List<? super Node> retList, int eCanonicalType, List<String> inclusiveNSPrefixList)
    Performs text normalization of a set of nodes.
    Gets the save options for canonicalized data.
    void
    Set the data for this canonicalize to work on.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CANONICALWITH

      public static final int CANONICALWITH
      Canonicalization type: generic canonicalization.
      See Also:
    • CANONICALWITHOUT

      public static final int CANONICALWITHOUT
      Canonicalization type: generic canonicalization with all comments removed.
      See Also:
    • EXCLUSIVEWITH

      public static final int EXCLUSIVEWITH
      Canonicalization type: exclusive canonicalization.
      See Also:
    • EXCLUSIVEWITHOUT

      public static final int EXCLUSIVEWITHOUT
      Canonicalization type: exclusive canonicalization with all comments removed.
      See Also:
    • SAVEWITH

      public static final int SAVEWITH
      Canonicalization type: generic canonicalization without the use of context namespaces.
      See Also:
    • SAVEWITHOUT

      public static final int SAVEWITHOUT
      Canonicalization type: generic canonicalization without the use of context namespaces and with all comments removed.
      See Also:
  • Constructor Details

    • Canonicalize

      public Canonicalize()
      Instantiates a canonicalization service.
    • Canonicalize

      public Canonicalize(boolean bLegacy_V32_Canonicalization)
      Instantiates a canonicalization service.
      Parameters:
      bLegacy_V32_Canonicalization - legacy protected canonicalization flag
    • Canonicalize

      public Canonicalize(Node node, boolean bInPlace, boolean bLegacy_V32_Canonicalization)
      Instantiates a canonicalization service.
      Parameters:
      node - a node to be canonicalized along with its children.
      bInPlace - whether to perform canonicalization on the node specified
      bLegacy_V32_Canonicalization - legacy protected canonicalization flag * or on a copy.
    • Canonicalize

      public Canonicalize(List<? extends Node> store, boolean bWithDescendants, boolean bLegacy_V32_Canonicalization)
      Instantiates a canonicalization service.
      Parameters:
      store - a list of nodes to be canonicalized.
      bWithDescendants - when true, canonicalize the descendants and
      bLegacy_V32_Canonicalization - legacy protected canonicalization flag * attributes of each node in the list; otherwise, do not.
  • Method Details

    • canonicalize

      public Document canonicalize(List<? super Node> retList, int eCanonicalType, List<String> inclusiveNSPrefixList)
      Performs text normalization of a set of nodes. This implies that:
      • CDATA sections are replaced with their character content.
      • XML declaration and document type declaration (DTD) are removed.
      • empty elements are converted to start-end tag pairs.
      • whitespace outside of the document element and within start and end tags is normalized.
      • all whitespace in character content is retained (excluding characters removed during line feed normalization).
      • special characters in attribute values and character content are replaced by character references.
      • encoding of special characters as character references in attribute values (&, <, ", CR, NL, TAB).
      • encoding of special characters as character references in text (&, <, >, CR).
      • superfluous namespace declarations are removed from each element.
      • default attributes are added to each element.
      • lexicographic order is imposed on the namespace declarations and attributes of each element.
      Parameters:
      retList - a list given by the caller to be populated with canonicalized nodes, by this method.
      eCanonicalType - the canonicalization type to use.
      inclusiveNSPrefixList - a list of namespace prefixes that are handled as though performing non-exclusive canonicalization, when exclusive canonicalization type is specified.
      Returns:
      the document.
    • canonicalize

      public byte[] canonicalize(int eCanonicalType, List<String> inclusiveNSPrefixList)
      Performs text normalization of a set of nodes. This implies that:
      • CDATA sections are replaced with their character content.
      • XML declaration and document type declaration (DTD) are removed.
      • empty elements are converted to start-end tag pairs.
      • whitespace outside of the document element and within start and end tags is normalized.
      • all whitespace in character content is retained (excluding characters removed during line feed normalization).
      • special characters in attribute values and character content are replaced by character references.
      • encoding of special characters as character references in attribute values (&, <, ", CR, NL, TAB).
      • encoding of special characters as character references in text (&, <, >, CR).
      • superfluous namespace declarations are removed from each element.
      • default attributes are added to each element.
      • lexicographic order is imposed on the namespace declarations and attributes of each element.
      Parameters:
      eCanonicalType - the canonicalization type to use: one of CANONICALWITH, CANONICALWITHOUT, EXCLUSIVEWITH or EXCLUSIVEWITHOUT.
      inclusiveNSPrefixList - a list of namespace prefixes that are handled as though performing non-exclusive canonicalization, when exclusive canonicalization type is specified.
      Returns:
      byte array containing the canonicalized, UTF-8 encoded, data.
    • canonicalize

      public void canonicalize(OutputStream out, int eCanonicalType, List<String> inclusiveNSPrefixList)
      Performs text normalization of a set of nodes. This implies that:
      • CDATA sections are replaced with their character content.
      • XML declaration and document type declaration (DTD) are removed.
      • empty elements are converted to start-end tag pairs.
      • whitespace outside of the document element and within start and end tags is normalized.
      • all whitespace in character content is retained (excluding characters removed during line feed normalization).
      • special characters in attribute values and character content are replaced by character references.
      • encoding of special characters as character references in attribute values (&, <, ", CR, NL, TAB).
      • encoding of special characters as character references in text (&, <, >, CR).
      • superfluous namespace declarations are removed from each element.
      • default attributes are added to each element.
      • lexicographic order is imposed on the namespace declarations and attributes of each element.
      Parameters:
      out - the stream to be populated with the the canonicalized data. The stream will be UTF-8 encoded.
      eCanonicalType - the canonicalization type to use: one of CANONICALWITH, CANONICALWITHOUT, EXCLUSIVEWITH or EXCLUSIVEWITHOUT.
      inclusiveNSPrefixList - a list of namespace prefixes that are handled as though performing non-exclusive canonicalization, when exclusive canonicalization type is specified.
    • getSaveOptions

      public DOMSaveOptions getSaveOptions()
      Gets the save options for canonicalized data.
      Returns:
      the save options for canonicalized data.
    • setData

      public void setData(Object node)
      Set the data for this canonicalize to work on.
      Parameters:
      node - a node to be canonicalized along with its children.