|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.net.CharEntityReference
The CharEntityReference
class is a utility class to escape or unescape a string into a character reference or an entity reference form.
Character reference refers to a specific character in the ISO/IEC 10646 character set in the following representation:
CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
Entity reference refers to the content of the named entity of the form '&XXX;'
, where XXX
represents the name of the entity. These names are defined in XML and HTML standards.
In escape operations, the entities 'amp', lt', 'gt', 'apos',
and 'quot'
are used as NAMED
entity references. DECIMAL
or HEXADECIMAL
character references are used for other characters.
In unescape operations, 'amp', 'lt', 'gt', 'apos', 'quot'
, and all entity references defined in HTML 4.01 are recognized in order to convert back to the original characters.
Nested Class Summary | |
static class |
CharEntityReference.Form Form parameter class that specifies the escaped form. |
Method Summary | |
static String |
escape(String srcstr) Escapes a string into the character entity reference in the NAMED_DECIMAL_NUMBER form assuming the WE8ISO8859P1 character set. |
static String |
escape(String srcstr, String dstCharset) Escapes a string into the character entity reference in the NAMED_DECIMAL_NUMBER form. |
static String |
escape(String srcstr, String dstCharset, CharEntityReference.Form form) Escapes a string into the character entity reference form. |
static String |
unescape(String srcstr) Converts an escaped string into a Unicode string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static String escape(String srcstr)
NAMED_DECIMAL_NUMBER
form assuming the WE8ISO8859P1 character set.
Default character set is WE8ISO8859P1, and the default form is the NAMED_DECIMAL_NUMBER
form. Some characters are escaped in the named entity, for example, <
for '<'
. Other characters are escaped in the hexadecimal form if they are not supported by the given character set.
srcstr
- a string to be escapedIllegalStateException
- if WE8ISO8859P1 is not supportedescape(String, String, CharEntityReference.Form)
public static String escape(String srcstr, String dstCharset) throws UnsupportedEncodingException
NAMED_DECIMAL_NUMBER
form.
The default form is the NAMED_DECIMAL_NUMBER
form. Some characters are escaped in the named entity, for example, <
for '<'
. Other characters are escaped in the hexadecimal form if they are not supported by the given character set.
srcstr
- a string to be escapeddstCharset
- an Oracle character set nameUnsupportedEncodingException
- if the dstCharset
is a invalid character set nameescape(String, String, CharEntityReference.Form)
public static String escape(String srcstr, String dstCharset, CharEntityReference.Form form) throws UnsupportedEncodingException
DECIMAL_NUMBER
or HEXADECIMAL_NUMBER
form, the following characters will be escaped in either the NAMED
, DECIMAL_NUMBER
, or HEXADECIMAL_NUMBER
forms:
<
- Less than sign (U+003C)>
- Greater than sign (U+003E)&
- Ampersand (U+0026)'
- Apostrophe (U+0027)"
- Quotation mark (U+0022)srcstr
- a string to be escapeddstCharset
- an Oracle character set nameform
- a form of character entity referenceUnsupportedEncodingException
- if the dstCharset
parameter is an invalid character set namepublic static String unescape(String srcstr)
srcstr
- a string containing escaped charactersIllegalArgumentException
- if unregistered character entity reference is used
|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |