org.apache.commons.betwixt.strategy
Class MixedContentEncodingStrategy

java.lang.Object
  extended by org.apache.commons.betwixt.strategy.MixedContentEncodingStrategy
Direct Known Subclasses:
BaseMixedContentEncodingStrategy

public abstract class MixedContentEncodingStrategy
extends java.lang.Object

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.

Since:
0.5
Author:
Apache Commons Team

Field Summary
static MixedContentEncodingStrategy CDATA
          Encodes element content within a CDATA section.
static java.lang.String CDATA_ENCODING
          The option value for CDATA
static MixedContentEncodingStrategy DEFAULT
          The standard implementation used by Betwixt by default.
static java.lang.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
static MixedContentEncodingStrategy ESCAPED_CHARACTERS
          Encodes by escaping character data.
 
Constructor Summary
MixedContentEncodingStrategy()
           
 
Method Summary
abstract  java.lang.String encode(java.lang.String bodyContent, ElementDescriptor element)
          Encodes the body content into a form suitable for output as (textual) xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_OPTION_NAME

public static final java.lang.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

See Also:
Constant Field Values

CDATA_ENCODING

public static final java.lang.String CDATA_ENCODING
The option value for CDATA

See Also:
Constant Field Values

DEFAULT

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.


CDATA

public static final MixedContentEncodingStrategy CDATA
Encodes element content within a CDATA section. This is a singleton.


ESCAPED_CHARACTERS

public static final MixedContentEncodingStrategy ESCAPED_CHARACTERS
Encodes by escaping character data. This is a singleton.

Constructor Detail

MixedContentEncodingStrategy

public MixedContentEncodingStrategy()
Method Detail

encode

public abstract java.lang.String encode(java.lang.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


Copyright 2002-2008 The Apache Software Foundation. All Rights Reserved.