[jdom-interest] Possible inconsistency in Verifier.isXMLCharacter()

Rolf Lear rlear at algorithmics.com
Thu Apr 10 14:47:57 PDT 2003


This is the code from isXMLCharacter().

    public static boolean isXMLCharacter(char c) {
    
        if (c == '\n') return true;
        if (c == '\r') return true;
        if (c == '\t') return true;
        
        if (c < 0x20) return false;  if (c <= 0xD7FF) return true;
        if (c < 0xE000) return false;  if (c <= 0xFFFD) return true;
        if (c < 0x10000) return false;  if (c <= 0x10FFFF) return true;
        
        return false;
    }

Now, according to Java spec, chars have value 0x0000 through 0xffff
(http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html
#9151)

Thus, the line:

if (c < 0x10000) return false;  if (c <= 0x10FFFF) return true;

is redundant, until there is a java with more than 2 byte chars.


So, whatever characters are meant to be in the range 0x10000 through 0x10FFF
they will never validate.

Rolf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030410/98c670e9/attachment.htm


More information about the jdom-interest mailing list