Package freemarker.core
Class XMLOutputFormat
- java.lang.Object
-
- freemarker.core.OutputFormat
-
- freemarker.core.MarkupOutputFormat<MO>
-
- freemarker.core.CommonMarkupOutputFormat<TemplateXMLOutputModel>
-
- freemarker.core.XMLOutputFormat
-
- Direct Known Subclasses:
XHTMLOutputFormat
public class XMLOutputFormat extends CommonMarkupOutputFormat<TemplateXMLOutputModel>
Represents the XML output format (MIME type "application/xml", name "XML"). This format escapes by default (viaStringUtil.XMLEnc(String)
). The?html
,?xhtml
and?xml
built-ins silently bypass template output values of the type produced by this output format (TemplateXHTMLOutputModel
).This class was final before 2.3.29.
- Since:
- 2.3.24
-
-
Field Summary
Fields Modifier and Type Field Description static XMLOutputFormat
INSTANCE
The only instance (singleton) of thisOutputFormat
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLOutputFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
escapePlainText(java.lang.String plainTextContent)
Should give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)
, but the implementation may uses a more efficient solution.java.lang.String
getMimeType()
Returns the MIME type of the output format.java.lang.String
getName()
The short name used to refer to this format (like in the#ftl
header).boolean
isLegacyBuiltInBypassed(java.lang.String builtInName)
Tells if a string built-in that can't handle aTemplateMarkupOutputModel
left hand operand can bypass this object as is.protected TemplateXMLOutputModel
newTemplateMarkupOutputModel(java.lang.String plainTextContent, java.lang.String markupContent)
Creates a newCommonTemplateMarkupOutputModel
that's bound to thisOutputFormat
instance.void
output(java.lang.String textToEsc, java.io.Writer out)
Equivalent to callingMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)
, but the implementation may uses 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.OutputFormat
toString, toStringExtraProperties
-
-
-
-
Field Detail
-
INSTANCE
public static final XMLOutputFormat INSTANCE
The only instance (singleton) of thisOutputFormat
.
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:OutputFormat
The short name used to refer to this format (like in the#ftl
header).- Specified by:
getName
in classOutputFormat
-
getMimeType
public java.lang.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.- Specified by:
getMimeType
in classOutputFormat
-
output
public void output(java.lang.String textToEsc, java.io.Writer out) throws java.io.IOException, TemplateModelException
Description copied from class:MarkupOutputFormat
Equivalent to callingMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.output(TemplateMarkupOutputModel, Writer)
, but the implementation may uses a more efficient solution.- Specified by:
output
in classCommonMarkupOutputFormat<TemplateXMLOutputModel>
- Throws:
java.io.IOException
TemplateModelException
-
escapePlainText
public java.lang.String escapePlainText(java.lang.String plainTextContent)
Description copied from class:MarkupOutputFormat
Should give the same result asMarkupOutputFormat.fromPlainTextByEscaping(String)
and thenMarkupOutputFormat.getMarkupString(TemplateMarkupOutputModel)
, but the implementation may uses a more efficient solution.- Specified by:
escapePlainText
in classMarkupOutputFormat<TemplateXMLOutputModel>
-
isLegacyBuiltInBypassed
public boolean isLegacyBuiltInBypassed(java.lang.String builtInName)
Description copied from class:MarkupOutputFormat
Tells if a string built-in that can't handle aTemplateMarkupOutputModel
left hand operand can bypass this object as is. A typical such case would be when aTemplateHTMLOutputModel
of "HTML" format bypasses?html
.- Specified by:
isLegacyBuiltInBypassed
in classMarkupOutputFormat<TemplateXMLOutputModel>
-
newTemplateMarkupOutputModel
protected TemplateXMLOutputModel newTemplateMarkupOutputModel(java.lang.String plainTextContent, java.lang.String markupContent)
Description copied from class:CommonMarkupOutputFormat
Creates a newCommonTemplateMarkupOutputModel
that's bound to thisOutputFormat
instance.- Specified by:
newTemplateMarkupOutputModel
in classCommonMarkupOutputFormat<TemplateXMLOutputModel>
-
-