Package org.owasp.esapi.codecs
Class XMLEntityCodec
- java.lang.Object
-
- org.owasp.esapi.codecs.Codec
-
- org.owasp.esapi.codecs.XMLEntityCodec
-
public class XMLEntityCodec extends Codec
Implementation of the Codec interface for XML entity encoding. This differes from HTML entity encoding in that only the following named entities are predefined:- lt
- gt
- amp
- apos
- quot
-
-
Constructor Summary
Constructors Constructor Description XMLEntityCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Character
decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString.java.lang.String
encodeCharacter(char[] immune, java.lang.Character c)
Default implementation that should be overridden in specific codecs.-
Methods inherited from class org.owasp.esapi.codecs.Codec
containsCharacter, decode, encode, getHexForNonAlphanumeric, toHex, toOctal
-
-
-
-
Method Detail
-
encodeCharacter
public java.lang.String encodeCharacter(char[] immune, java.lang.Character c)
Default implementation that should be overridden in specific codecs. Encodes a Character using XML entities as necessary.- Overrides:
encodeCharacter
in classCodec
- Parameters:
immune
- characters that should not be encoded as entitiesc
- the Character to encode- Returns:
- the encoded Character
-
decodeCharacter
public java.lang.Character decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString. If the current character is not encoded, this method MUST reset the PushbackString. Returns the decoded version of the character starting at index, or null if no decoding is possible. Legal formats:- &#dddd;
- &#xhhhh;
- &name;
- Overrides:
decodeCharacter
in classCodec
- Parameters:
input
- the Character to decode- Returns:
- the decoded Character
-
-