Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.plugins.codecs
[Java] Class XMLEncoder

    java.lang.Object
      org.codehaus.groovy.grails.plugins.codecs.AbstractCharReplacementEncoder
          org.codehaus.groovy.grails.plugins.codecs.XMLEncoder

    public class XMLEncoder
    extends AbstractCharReplacementEncoder

Encoder implementation that escapes some characters for inclusion in XML documents Currently ', ", <, > and & characters are replaced with XML entities. Additionally backslash (/), non-breaking space, backtick (`) and @ are also replaced for visibility/additional security.

Authors:
  Lari Hotari

Since:
  2.3

Field Summary
`static CodecIdentifier` | `XML_CODEC_IDENTIFIER`

Fields inherited from class AbstractCharReplacementEncoder
codecIdentifier

Constructor Summary
`XMLEncoder()`
`protected XMLEncoder(CodecIdentifier codecIdentifier)`

Method Summary
`protected java.lang.Object` | `doEncode(java.lang.Object o)`
`java.lang.Object` | `encode(java.lang.Object o)`
`protected java.lang.Object` | `encodeToXmlString(java.lang.Object o)`
`protected java.lang.String` | `escapeCharacter(char ch, char previousChar)`
`protected static java.lang.String` | `xmlEscapeCharacter(char ch)`

Methods inherited from class AbstractCharReplacementEncoder
convertToString, doCharReplacementEncoding, encode, encodeToStream, encodeToWriter, escapeCharSequence, escapeCharacter, getCodecIdentifier, isApplyToSafelyEncoded, isSafe, markEncoded

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### XML_CODEC_IDENTIFIER

    public static final CodecIdentifier XML_CODEC_IDENTIFIER

Constructor Detail

### XMLEncoder

    public XMLEncoder()

### XMLEncoder

    protected XMLEncoder(CodecIdentifier codecIdentifier)

Method Detail

### doEncode

    protected java.lang.Object doEncode(java.lang.Object o)

### encode

    @java.lang.Override}
    public final java.lang.Object encode(java.lang.Object o)

### encodeToXmlString

    protected java.lang.Object encodeToXmlString(java.lang.Object o)

### escapeCharacter

    @java.lang.Overridereturn "";
    protected java.lang.String escapeCharacter(char ch, char previousChar)

### xmlEscapeCharacter

    protected static final java.lang.String xmlEscapeCharacter(char ch)

Groovy Documentation