Class XmlSerializer

    • Method Detail

      • setCreatingHtmlDom

        public void setCreatingHtmlDom​(boolean creatingHtmlDom)
        Parameters:
        creatingHtmlDom - the creatingHtmlDom to set
      • isCreatingHtmlDom

        public boolean isCreatingHtmlDom()
        Returns:
        the creatingHtmlDom
      • escapeXml

        protected String escapeXml​(String xmlContent)
      • dontEscape

        protected boolean dontEscape​(TagNode tagNode)
      • isMinimizedTagSyntax

        protected boolean isMinimizedTagSyntax​(TagNode tagNode)
      • serializeCData

        protected void serializeCData​(CData item,
                                      TagNode tagNode,
                                      Writer writer)
                               throws IOException
        Serialize a CDATA section. If the context is a script or style tag, and using CDATA for script and style is set to true, then we just write the actual content, as the whole section is wrapped in CDATA tokens. Otherwise we escape the content as if it were regular text.
        Parameters:
        item - the CDATA instance
        tagNode - the TagNode within which the CDATA appears
        writer - the writer to output to
        Throws:
        IOException
      • serializeContentToken

        protected void serializeContentToken​(ContentNode item,
                                             TagNode tagNode,
                                             Writer writer)
                                      throws IOException
        Serialize a content token, escaping where necessary.
        Parameters:
        item - the content token to serialize
        tagNode - the TagNode within which the content token appears
        writer - the writer to output to
        Throws:
        IOException
      • isForbiddenTag

        protected boolean isForbiddenTag​(TagNode tagNode)
        Parameters:
        tagNode -
        Returns:
        true if the tag is forbidden
      • isHeadOrBody

        protected boolean isHeadOrBody​(String tagName)
      • serializeAttribute

        protected void serializeAttribute​(TagNode tagNode,
                                          Writer writer,
                                          String attName,
                                          String attValue)
                                   throws IOException
        This allows overriding to eliminate forbidden attributes (for example javascript attributes onclick, onblur, etc. )
        Parameters:
        writer -
        attName -
        attValue -
        Throws:
        IOException
      • isForbiddenAttribute

        protected boolean isForbiddenAttribute​(TagNode tagNode,
                                               String attName,
                                               String value)
        Override to add additional conditions.
        Parameters:
        tagNode -
        attName -
        value -
        Returns:
        true if the attribute should not be outputed.