|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.simonstl.gorille.CharRules
This class stores a set of ranges of characters, allowing XML processors to test against different kinds of ranges.
Version 0.07 fixes the surrogate pairs code so that it returns false if the second code value in a surrogate pair isn't a low surrogate.
Version 0.06 fixes the character-checking so it rejects low surrogates that appear without a prior high surrogate. Thanks to Elliotte Rusty Harold for pointing this out.
Version 0.04 changes from char values to int values in order to support Unicode characters (surrogate pairs) outside of Plane 0. Thanks to Elliotte Rusty Harold for noticing, and John Cowan for suggesting a solution.
for each char in the String if in the range 0xD800 to 0xDBFF grab the next char as well set int[] element to (this-0xD800) * 0x400 + (next-0xDC00) + 10000 else set int[] element to value of this charVersion 0.03 adds additional support for namespace-handling. Version 0.02 adds support for pubidChar.
Field Summary | |
protected CharRanges |
addlNameChar
|
protected CharRanges |
baseChar
|
protected CharRanges |
chars
|
protected CharRanges |
combiningChar
|
protected CharRanges |
digit
|
protected CharRanges |
extender
|
protected CharRanges |
ideographic
|
protected boolean |
namespaceAware
|
protected CharRanges |
nameStartChar
|
protected CharRanges |
pubidChar
|
protected CharRanges |
space
|
Constructor Summary | |
CharRules()
|
Method Summary | |
boolean |
getNamespaceAware()
|
boolean |
isAddlNameChar(int test)
Checks characters after the beginning of names against the range of acceptable additional name characters, if there is one. |
boolean |
isBaseChar(int test)
Checks characters to see if they are part of the BaseChar range. |
boolean |
isChar(int test)
Checks characters against the range of acceptable Char characters. |
boolean |
isChars(char[] ch,
int start,
int length)
Checks a character array from SAX to see if it conforms to the Chars rules. |
boolean |
isChars(java.lang.String test)
Checks a String to see if it conforms to the Chars rules. |
boolean |
isCombiningChar(int test)
Checks characters to see if they are part of the CombiningChar range. |
boolean |
isDigit(int test)
Checks characters to see if they are part of the Digit range. |
boolean |
isExtender(int test)
Checks characters to see if they are part of the Extender range. |
boolean |
isIdeographic(int test)
Checks characters to see if they are part of the Ideographic range. |
boolean |
isLetter(int test)
Checks characters to see if they are part of the Letter range - in XML 1.0, that's the combination of BaseChar and Ideographic. |
boolean |
isName(java.lang.String test)
Checks a String to see if it conforms to the Name rules. |
boolean |
isNameChar(int test)
Checks characters to see if they are part of the Name range - in XML 1.0, that's the combination of BaseChar, Ideographic, CombiningChar, and Extender. |
boolean |
isNames(java.lang.String test)
Checks a String to see if it conforms to the NAMES rules. |
boolean |
isNameStartChar(int test)
Checks characters at the beginning of names against the range of acceptable NameStartChar characters, if there is one, and falls back on XML 1.0's Letter rules if there isn't. |
boolean |
isNMTOKEN(java.lang.String test)
Checks a String to see if it conforms to the NMTOKEN rules. |
boolean |
isNMTOKENS(java.lang.String test)
Checks a String to see if it conforms to the NMTOKENS rules. |
boolean |
isPubid(java.lang.String test)
Checks a String to see if it conforms to the Pubid rules. |
boolean |
isPubidChar(int test)
Checks characters to see if they are part of the PubidChar range. |
boolean |
isQName(java.lang.String test)
Checks a String to see if it conforms to the QName rules. |
boolean |
isSpace(int test)
Checks characters to see if they are whitespace. |
void |
print()
|
void |
setAddlNameChar(CharRanges _addlNameChar)
Sets the range representing the list of additional characters which can be used in names after they start. |
void |
setBaseChar(CharRanges _baseChar)
Sets the range representing the BaseChar production from XML 1.0. |
void |
setChar(CharRanges _chars)
Sets the list of overall characters for content. |
void |
setCombiningChar(CharRanges _combiningChar)
Sets the range representing the CombiningChar production from XML 1.0 |
void |
setDigit(CharRanges _digit)
Sets the range representing the Digit production from XML 1.0 |
void |
setExtender(CharRanges _extender)
Sets the range representing the Extender production from XML 1.0 |
void |
setIdeographic(CharRanges _ideographic)
Sets the range representing the Ideographic production from XML 1.0 |
void |
setNamespaceAware(boolean _namespaceAware)
|
void |
setNameStartChar(CharRanges _nameStartChar)
Sets the range representing the list of characters for use at the beginning of names. |
void |
setPubidChar(CharRanges _pubidChar)
Sets the range representing the PubidChar production from XML 1.0 |
void |
setSpace(CharRanges _space)
Sets the range representing the characters which represent whitespace. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected CharRanges chars
protected CharRanges nameStartChar
protected CharRanges addlNameChar
protected CharRanges space
protected CharRanges baseChar
protected CharRanges ideographic
protected CharRanges combiningChar
protected CharRanges digit
protected CharRanges extender
protected CharRanges pubidChar
protected boolean namespaceAware
Constructor Detail |
public CharRules()
Method Detail |
public void setNamespaceAware(boolean _namespaceAware)
public boolean getNamespaceAware()
public void setChar(CharRanges _chars)
public void setNameStartChar(CharRanges _nameStartChar)
public void setAddlNameChar(CharRanges _addlNameChar)
public void setSpace(CharRanges _space)
public void setBaseChar(CharRanges _baseChar)
public void setIdeographic(CharRanges _ideographic)
public void setCombiningChar(CharRanges _combiningChar)
public void setDigit(CharRanges _digit)
public void setExtender(CharRanges _extender)
public void setPubidChar(CharRanges _pubidChar)
public boolean isChar(int test)
public boolean isNameStartChar(int test)
public boolean isAddlNameChar(int test)
public boolean isSpace(int test)
public boolean isBaseChar(int test)
public boolean isIdeographic(int test)
public boolean isCombiningChar(int test)
public boolean isDigit(int test)
public boolean isExtender(int test)
public boolean isPubidChar(int test)
public boolean isLetter(int test)
public boolean isNameChar(int test)
public boolean isChars(java.lang.String test)
public boolean isChars(char[] ch, int start, int length)
public boolean isName(java.lang.String test)
public boolean isQName(java.lang.String test)
public boolean isNMTOKEN(java.lang.String test)
public boolean isNMTOKENS(java.lang.String test)
public boolean isNames(java.lang.String test)
public boolean isPubid(java.lang.String test)
public java.lang.String toString()
toString
in class java.lang.Object
public void print()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |