public abstract class

MixedContentEncodingStrategy

extends Object
java.lang.Object
   ↳ org.apache.commons.betwixt.strategy.MixedContentEncodingStrategy
Known Direct Subclasses

Class Overview

Encodes body content.

Usage: Used by BeanWriter to encode body content before it is written into the textual output. This gives flexibility in this stage allowing (for example) some properties to use character escaping whilst others use CDATA wrapping.

Note: the word encoding here is used in the sense of escaping a sequence of character data.

Summary

Constants
String CDATA_ENCODING The option value for CDATA
String ENCODING_OPTION_NAME The name of the option used to specify encoding on a per-element basis is org.apache.commons.betwixt.mixed-content-encoding
Fields
public static final MixedContentEncodingStrategy CDATA Encodes element content within a CDATA section.
public static final MixedContentEncodingStrategy DEFAULT The standard implementation used by Betwixt by default.
public static final MixedContentEncodingStrategy ESCAPED_CHARACTERS Encodes by escaping character data.
Public Constructors
MixedContentEncodingStrategy()
Public Methods
abstract String encode(String bodyContent, ElementDescriptor element)
Encodes the body content into a form suitable for output as (textual) xml.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String CDATA_ENCODING

The option value for CDATA

Constant Value: "CDATA"

public static final String ENCODING_OPTION_NAME

The name of the option used to specify encoding on a per-element basis is org.apache.commons.betwixt.mixed-content-encoding

Constant Value: "org.apache.commons.betwixt.mixed-content-encoding"

Fields

public static final MixedContentEncodingStrategy CDATA

Encodes element content within a CDATA section. This is a singleton.

public static final MixedContentEncodingStrategy DEFAULT

The standard implementation used by Betwixt by default. The default is to escape as character data unless the ElementDescriptor contains an option with name org.apache.commons.betwixt.mixed-content-encoding and value CDATA. This is a singleton.

public static final MixedContentEncodingStrategy ESCAPED_CHARACTERS

Encodes by escaping character data. This is a singleton.

Public Constructors

public MixedContentEncodingStrategy ()

Public Methods

public abstract String encode (String bodyContent, ElementDescriptor element)

Encodes the body content into a form suitable for output as (textual) xml.

Parameters
bodyContent the raw (unescaped) character data, not null
element the ElementDescriptor describing the element whose content is being encoded.
Returns
  • the encoded (escaped) character data, not null