org.jboss.dna.common.text
Class XmlValueEncoder
java.lang.Object
org.jboss.dna.common.text.XmlValueEncoder
- All Implemented Interfaces:
- TextDecoder, TextEncoder
@Immutable
public class XmlValueEncoder
- extends Object
- implements TextEncoder, TextDecoder
An encoder useful for converting text to be used within XML attribute values. The following translations will be performed:
Raw (Unencoded) Character |
Translated (Encoded) Entity |
& |
& |
< |
< |
> |
> |
" |
" |
' |
' |
All Others |
No Translation |
XmlValueEncoder
public XmlValueEncoder()
encode
public String encode(String text)
- Returns the encoded version of a string.
- Specified by:
encode
in interface TextEncoder
- Parameters:
text
- the text with characters that are to be encoded.
- Returns:
- the text with the characters encoded as required, or null if the supplied text is null
- See Also:
TextEncoder.encode(java.lang.String)
decode
public String decode(String encodedText)
- Return the decoded version of an encoded string
- Specified by:
decode
in interface TextDecoder
- Parameters:
encodedText
- the encoded text
- Returns:
- the unecoded form of the text, or null if the supplied node name is also null
- See Also:
TextDecoder.decode(java.lang.String)
Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.