|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectau.id.jericho.lib.html.Segment
au.id.jericho.lib.html.CharacterReference
au.id.jericho.lib.html.NumericCharacterReference
Represents an HTML Numeric Character Reference.
Static methods to encode and decode strings
and single characters can be found in the CharacterReference
superclass.
NumericCharacterReference
objects are created using one of the following methods:
CharacterReference.parse(CharSequence characterReferenceText)
Source.findNextCharacterReference(int pos)
Source.findPreviousCharacterReference(int pos)
Segment.findAllCharacterReferences()
CharacterReference
Field Summary |
Fields inherited from class au.id.jericho.lib.html.CharacterReference |
ApostropheEncoded, INVALID_CODE_POINT |
Method Summary | |
static java.lang.String |
encode(java.lang.CharSequence unencodedText)
Encodes the specified text, escaping special characters into numeric character references. |
static java.lang.String |
encodeDecimal(java.lang.CharSequence unencodedText)
Encodes the specified text, escaping special characters into decimal numeric character references. |
static java.lang.String |
encodeHexadecimal(java.lang.CharSequence unencodedText)
Encodes the specified text, escaping special characters into hexadecimal numeric character references. |
java.lang.String |
getCharacterReferenceString()
Returns the correct encoded form of this numeric character reference. |
static java.lang.String |
getCharacterReferenceString(int codePoint)
Returns the numeric character reference encoded form of the specified Unicode code point. |
java.lang.String |
getDebugInfo()
Returns a string representation of this object useful for debugging purposes. |
boolean |
isDecimal()
Indicates whether this numeric character reference is in decimal format. |
boolean |
isHexadecimal()
Indicates whether this numeric character reference is in hexadecimal format. |
Methods inherited from class au.id.jericho.lib.html.Segment |
charAt, compareTo, encloses, encloses, equals, findAllCharacterReferences, findAllComments, findAllElements, findAllElements, findAllStartTags, findAllStartTags, findAllStartTags, findFormControls, findFormFields, findWords, getBegin, getEnd, getSourceText, getSourceTextNoWhitespace, hashCode, ignoreWhenParsing, isComment, isWhiteSpace, length, parseAttributes, subSequence, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public boolean isDecimal()
>
")
This flag is set depending on whether character reference in the source document was in decimal or hexadecimal format.
true
if this numeric character reference is in decimal format, otherwise false
.public boolean isHexadecimal()
>
")
This flag is set depending on whether character reference in the source document was in hexadecimal or decimal format.
true
if this numeric character reference is in hexadecimal format, otherwise false
.public static java.lang.String encode(java.lang.CharSequence unencodedText)
Each character is encoded only if the requiresEncoding(char)
method would return true
for that character.
This method encodes all character references in decimal format, and is exactly the same as calling
encodeDecimal(CharSequence)
.
To encode text using both character entity references and numeric character references, use the
CharacterReference.encode(CharSequence)
method instead.
To encode text using hexadecimal numeric character references only, use the encodeHexadecimal(CharSequence)
method instead.
unencodedText
- the text to encode.
CharacterReference.decode(CharSequence encodedText)
public static java.lang.String encodeDecimal(java.lang.CharSequence unencodedText)
Each character is encoded only if the requiresEncoding(char)
method would return true
for that character.
To encode text using both character entity references and numeric character references, use the
CharacterReference.encode(CharSequence)
method instead.
To encode text using hexadecimal numeric character references only, use the encodeHexadecimal(CharSequence)
method instead.
unencodedText
- the text to encode.
CharacterReference.decode(CharSequence encodedText)
public static java.lang.String encodeHexadecimal(java.lang.CharSequence unencodedText)
Each character is encoded only if the requiresEncoding(char)
method would return true
for that character.
To encode text using both character entity references and numeric character references, use the
CharacterReference.encode(CharSequence)
method instead.
To encode text using decimal numeric character references only, use the encodeDecimal(CharSequence)
method instead.
unencodedText
- the text to encode.
CharacterReference.decode(CharSequence encodedText)
public java.lang.String getCharacterReferenceString()
The returned string will use the same radix as the original character reference in the source document,
i.e. decimal format if isDecimal()
is true
, and hexadecimal format if isHexadecimal()
is true
.
Note that the returned string is not necessarily the same as the original source text used to create this object.
This library will recognise certain invalid forms of character references, as detailed in the decode(CharSequence encodedText)
method.
To retrieve the original source text, use the toString()
method instead.
CharacterReference.parse(">").getCharacterReferenceString()
returns ">
"
getCharacterReferenceString
in class CharacterReference
CharacterReference.getCharacterReferenceString(int codePoint)
public static java.lang.String getCharacterReferenceString(int codePoint)
This method returns the character reference in decimal format, and is exactly the same as calling
CharacterReference.getDecimalCharacterReferenceString(int codePoint)
.
To get either the character entity reference or numeric character reference, use the
CharacterReference.getCharacterReferenceString(int codePoint)
method instead.
To get the character reference in hexadecimal format, use the CharacterReference.getHexadecimalCharacterReferenceString(int codePoint)
method instead.
NumericCharacterReference.getCharacterReferenceString(62)
returns ">
"NumericCharacterReference.getCharacterReferenceString('>')
returns ">
"
CharacterReference.getCharacterReferenceString(int codePoint)
public java.lang.String getDebugInfo()
Segment
getDebugInfo
in class Segment
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |