XHTMLOutputFormat (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.core, class: XHTMLOutputFormat

Package freemarker.core

# Class XHTMLOutputFormat

java.lang.Object
freemarker.core.OutputFormat
freemarker.core.MarkupOutputFormat<MO>
freemarker.core.CommonMarkupOutputFormat<TemplateXMLOutputModel>
freemarker.core.XMLOutputFormat
freemarker.core.XHTMLOutputFormat

public class XHTMLOutputFormat extends XMLOutputFormat
Represents the XML output format (MIME type "application/xhtml+xml", name "XHTML"); this behaves identically to `HTMLOutputFormat`, except that the name an the MIME Type differs. Yet, it extends `XMLOutputFormat`, as XHTML documents is a subset of XML documents, but not of HTML documents.

This class was final before 2.3.29.

Since:
  2.3.24

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static XHTMLOutputFormat`
  `INSTANCE`
  The only instance (singleton) of this `OutputFormat`.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `XHTMLOutputFormat()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `escapePlainText​(String plainTextContent)`
  Should give the same result as `MarkupOutputFormat.fromPlainTextByEscaping(String)` and then `MarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)`, but the implementation may use a more efficient solution.
  `String`
  `getMimeType()`
  Returns the MIME type of the output format.
  `String`
  `getName()`
  The short name used to refer to this format (like in the `#ftl` header).
  `boolean`
  `isLegacyBuiltInBypassed​(String builtInName)`
  Tells if a string built-in that can't handle a `TemplateMarkupOutputModel` left hand operand can bypass this object as is.
  `protected TemplateXHTMLOutputModel`
  `newTemplateMarkupOutputModel​(String plainTextContent, String markupContent)`
  Creates a new `CommonTemplateMarkupOutputModel` that's bound to this `OutputFormat` instance.
  `void`
  `output​(String textToEsc, Writer out)`
  Equivalent to calling `MarkupOutputFormat.fromPlainTextByEscaping(String)` and then `MarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)`, but the implementation may use a more efficient solution.

  ### Methods inherited from class freemarker.core.CommonMarkupOutputFormat

  `concat, fromMarkup, fromPlainTextByEscaping, getMarkupString, getSourcePlainText, isAutoEscapedByDefault, isEmpty, isOutputFormatMixingAllowed, output`

  ### Methods inherited from class freemarker.core.MarkupOutputFormat

  `outputForeign`

  ### Methods inherited from class freemarker.core.OutputFormat

  `toString, toStringExtraProperties`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### INSTANCE

    public static final XHTMLOutputFormat INSTANCE
    The only instance (singleton) of this `OutputFormat`.

- ## Constructor Details

  - ### XHTMLOutputFormat

    protected XHTMLOutputFormat()
    Since:
      2.3.29

- ## Method Details

  - ### getName

    public String getName()
    Description copied from class: `OutputFormat`
    The short name used to refer to this format (like in the `#ftl` header).
    Overrides:
      `getName` in class `XMLOutputFormat`

  - ### getMimeType

    public String getMimeType()
    Description copied from class: `OutputFormat`
    Returns the MIME type of the output format. This might comes handy when generating a HTTP response. `null` `null` if this output format doesn't clearly corresponds to a specific MIME type.
    Overrides:
      `getMimeType` in class `XMLOutputFormat`

  - ### output

    public void output​(String textToEsc, Writer out) throws IOException, TemplateModelException
    Description copied from class: `MarkupOutputFormat`
    Equivalent to calling `MarkupOutputFormat.fromPlainTextByEscaping(String)` and then `MarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)`, but the implementation may use a more efficient solution.
    Overrides:
      `output` in class `XMLOutputFormat`
    Throws:
      `IOException`
      `TemplateModelException`

  - ### escapePlainText

    public String escapePlainText​(String plainTextContent)
    Description copied from class: `MarkupOutputFormat`
    Should give the same result as `MarkupOutputFormat.fromPlainTextByEscaping(String)` and then `MarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)`, but the implementation may use a more efficient solution.
    Overrides:
      `escapePlainText` in class `XMLOutputFormat`

  - ### isLegacyBuiltInBypassed

    public boolean isLegacyBuiltInBypassed​(String builtInName)
    Description copied from class: `MarkupOutputFormat`
    Tells if a string built-in that can't handle a `TemplateMarkupOutputModel` left hand operand can bypass this object as is. A typical such case would be when a `TemplateHTMLOutputModel` of "HTML" format bypasses `?html`.
    Overrides:
      `isLegacyBuiltInBypassed` in class `XMLOutputFormat`

  - ### newTemplateMarkupOutputModel

    protected TemplateXHTMLOutputModel newTemplateMarkupOutputModel​(String plainTextContent, String markupContent)
    Description copied from class: `CommonMarkupOutputFormat`
    Creates a new `CommonTemplateMarkupOutputModel` that's bound to this `OutputFormat` instance. When this is called from `CommonMarkupOutputFormat`, exactly one of the parameters will be non-`null`.
    Overrides:
      `newTemplateMarkupOutputModel` in class `XMLOutputFormat`
    Parameters:
      `plainTextContent` - `null` if the content is markup that possibly can be described as plain text without loss.
      `markupContent` - Typically will be `null` if `plainTextContent` is not `null`. While the plain text always can be converted to markup via `MarkupOutputFormat.escapePlainText(String)`, it's up to the implementation if it wants to do that now and store the markup, or later on demand (like each time when `CommonMarkupOutputFormat.getMarkupString(CommonTemplateMarkupOutputModel)` is called).