while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } }   if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value));    if (value > 0x0010ffff) {  error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); }
while (true) { c = readCh(); if (c == ';') { break loop2; } else { int n = Character.digit(c, 10); if (n == -1) { error("illegal character in character reference", c, null); break loop2; } value *= 10; value += n; } } }   if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) { error("illegal XML character reference U+" + Integer.toHexString(value)); }    if (value > 0x0010ffff) {  error("character reference " + value + " is too large for UTF-16", new Integer(value).toString(), null); }
  private void tryReadCharRef ()  throws SAXException, IOException  {  	int value = 0;	char c;	if (tryRead ('x')) {loop1:	    while (true) {		c = readCh ();		int n;		switch (c) {		case '0': case '1': case '2': case '3': case '4':		case '5': case '6': case '7': case '8': case '9':		    n = c - '0';		    break;		case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':		    n = (c - 'a') + 10;		    break;		case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':		    n = (c - 'A') + 10;		    break;		case ';':		    break loop1;		default:		    error ("illegal character in character reference", c, null);		    break loop1;		}		value *= 16;		value += n;	    }	} else {loop2:	    while (true) {		c = readCh ();		switch (c) {		case '0': case '1': case '2': case '3': case '4':		case '5': case '6': case '7': case '8': case '9':		    value *= 10;		    value += c - '0';		    break;		case ';':		    break loop2;		default:		    error ("illegal character in character reference", c, null);		    break loop2;		}	    }	}	// check for character refs being legal XML	if ((value < 0x0020		&& ! (value == '\n' || value == '\t' || value == '\r'))		|| (value >= 0xD800 && value <= 0xDFFF)		|| value == 0xFFFE || value == 0xFFFF		|| value > 0x0010ffff)	    error ("illegal XML character reference U+"		    + Integer.toHexString (value));	// Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz	//  (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:	if (value > 0x0010ffff) {	    // too big for surrogate	    error ("character reference " + value + " is too large for UTF-16",		   new Integer (value).toString (), null);	}  }