|
Oracle® Globalization Development Kit Java API Reference 10g Release 1(10.1) B10971-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.net.CharEntityReference
CharEntityReference is a utility class to escape or unescape a string into character reference or 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 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 recognized in order to convert back to 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 form in NAMED_DECIMAL_NUMBER assuming WE8ISO8859P1 character set.
|
static String |
escape(String srcstr,
String dstCharset)
Escapes a String into the character entity refernce form in NAMED_DECIMAL_NUMBER .
|
static String |
escape(String srcstr,
String dstCharset,
CharEntityReference.Form form)
Escapes a String into the character entity refernce 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
assuming WE8ISO8859P1 character set.
Default character set is WE8ISO8859P1, and default form is
NAMED_DECIMAL_NUMBER
. Some characters are escaped in the
named entity, e.g., <
for '<'
; other
characters are escaped in the hexadecimal form if they are not supported
by the given character set.
srcstr
- a String to be escaped
String
object
IllegalStateException
- if WE8ISO8859P1 is not supported.escape(String, String, CharEntityReference.Form)
public static String escape(String srcstr, String dstCharset) throws UnsupportedEncodingException
NAMED_DECIMAL_NUMBER
.
Default form is NAMED_DECIMAL_NUMBER
. Some characters are
escaped in the named entity, e.g., <
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 name
String
object
UnsupportedEncodingException
- if the dstCharset
is a
invalid character set name.escape(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 NAMED
,
DECIMAL_NUMBER
, or HEXADECIMAL_NUMBER
forms:
srcstr
- a String
to be escapeddstCharset
- an Oracle character set nameform
- a form of character entity reference
String
object
UnsupportedEncodingException
- if the dstCharset
is
invalid character set name.public static String unescape(String srcstr)
srcstr
- a string containing escaped characters
String
representing the original data
IllegalArgumentException
- if unregistered character entity
reference is used.
|
Oracle® Globalization Development Kit Java API Reference 10g Release 1(10.1) B10971-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |