Class AbstractSerializer

    • Field Detail

      • secureValidation

        protected boolean secureValidation
    • Constructor Detail

      • AbstractSerializer

        public AbstractSerializer()
    • Method Detail

      • serialize

        public String serialize​(Element element)
                         throws Exception
        Returns a String representation of the specified Element.

        Refer also to comments about setup of format.
        Parameters:
        element - the Element to serialize.
        Returns:
        the String representation of the serilaized Element.
        Throws:
        Exception
      • serializeToByteArray

        public byte[] serializeToByteArray​(Element element)
                                    throws Exception
        Returns a byte[] representation of the specified Element.
        Specified by:
        serializeToByteArray in interface Serializer
        Parameters:
        element - the Element to serialize.
        Returns:
        the byte[] representation of the serilaized Element.
        Throws:
        Exception
      • serialize

        public String serialize​(NodeList content)
                         throws Exception
        Returns a String representation of the specified NodeList.

        This is a special case because the NodeList may represent a DocumentFragment. A document fragment may be a non-valid XML document (refer to appropriate description of W3C) because it my start with a non-element node, e.g. a text node.

        The methods first converts the node list into a document fragment. Special care is taken to not destroy the current document, thus the method clones the nodes (deep cloning) before it appends them to the document fragment.

        Refer also to comments about setup of format.
        Parameters:
        content - the NodeList to serialize.
        Returns:
        the String representation of the serialized NodeList.
        Throws:
        Exception
      • serializeToByteArray

        public byte[] serializeToByteArray​(NodeList content)
                                    throws Exception
        Returns a byte[] representation of the specified NodeList.
        Specified by:
        serializeToByteArray in interface Serializer
        Parameters:
        content - the NodeList to serialize.
        Returns:
        the byte[] representation of the serialized NodeList.
        Throws:
        Exception
      • canonSerialize

        public String canonSerialize​(Node node)
                              throws Exception
        Use the Canonicalizer to serialize the node
        Parameters:
        node -
        Returns:
        the canonicalization of the node
        Throws:
        Exception
      • canonSerializeToByteArray

        public byte[] canonSerializeToByteArray​(Node node)
                                         throws Exception
        Use the Canonicalizer to serialize the node
        Specified by:
        canonSerializeToByteArray in interface Serializer
        Parameters:
        node -
        Returns:
        the (byte[]) canonicalization of the node
        Throws:
        Exception
      • createContext

        protected static String createContext​(String source,
                                              Node ctx)
      • isSecureValidation

        public boolean isSecureValidation()
      • setSecureValidation

        public void setSecureValidation​(boolean secureValidation)