Interface MarkupModel

  • All Known Implementing Classes:
    AbstractMarkupModel, DefaultMarkupModel, Html5MarkupModel, XMLMarkupModel

    public interface MarkupModel
    Used by a the DOM to determine how to produce markup. Delegates details about converted entities and some formatting details. This exists to handle the differences between traditional HTML output (which is SGML based, meaning there can be elements that are valid without a close tag) and "modern" XML, such as XHTML. Generally speaking, for XHTML it is vital that a !DOCTYPE be included in the rendered response, or the browser will be unable to display the result properly.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String encode​(java.lang.String content)
      Encodes the characters, converting control characters (such as '<') into corresponding entities (such as &lt;).
      void encodeQuoted​(java.lang.String content, java.lang.StringBuilder buffer)
      Encodes the characters into the buffer for use in a quoted value (that is, an attribute value), converting control characters (such as '<') into corresponding entities (such as &lt;).
      char getAttributeQuote()
      What character is used when generating quotes around attribute values? This will be either a single or double quote.
      EndTagStyle getEndTagStyle​(java.lang.String element)
      For a given element, determines how the end tag for the element should be rendered.
      boolean isXML()
      Returns true if the document markup is XML, which is used to determine the need for an XML declaration at the start of the document, and whether CDATA sections are supported.
    • Method Detail

      • encode

        java.lang.String encode​(java.lang.String content)
        Encodes the characters, converting control characters (such as '<') into corresponding entities (such as &lt;).
        Parameters:
        content - to be filtered
        Returns:
        the filtered content
      • encodeQuoted

        void encodeQuoted​(java.lang.String content,
                          java.lang.StringBuilder buffer)
        Encodes the characters into the buffer for use in a quoted value (that is, an attribute value), converting control characters (such as '<') into corresponding entities (such as &lt;). In addition, double quotes must be quoted or otherwise escaped.
        Parameters:
        content - to be filtered
        buffer - to receive the filtered content
      • getEndTagStyle

        EndTagStyle getEndTagStyle​(java.lang.String element)
        For a given element, determines how the end tag for the element should be rendered.
      • isXML

        boolean isXML()
        Returns true if the document markup is XML, which is used to determine the need for an XML declaration at the start of the document, and whether CDATA sections are supported.
        Returns:
        true for XML output, false for HTML output
      • getAttributeQuote

        char getAttributeQuote()
        What character is used when generating quotes around attribute values? This will be either a single or double quote.
        Returns:
        single (') or double (") quote
        Since:
        5.1.0.0