in batik-xml/src/main/java/org/apache/batik/xml/XMLScanner.java [1766:1865]
protected int nextInEntity() throws IOException, XMLException {
switch (current) {
case 0x9:
case 0xA:
case 0xD:
case 0x20:
do {
nextChar();
} while (current != -1 &&
XMLUtilities.isXMLSpace((char)current));
return LexicalUnits.S;
case '>':
nextChar();
context = DTD_DECLARATIONS_CONTEXT;
return LexicalUnits.END_CHAR;
case '%':
nextChar();
return LexicalUnits.PERCENT;
case 'S':
return readIdentifier("YSTEM",
LexicalUnits.SYSTEM_IDENTIFIER,
LexicalUnits.NAME);
case 'P':
return readIdentifier("UBLIC",
LexicalUnits.PUBLIC_IDENTIFIER,
LexicalUnits.NAME);
case 'N':
return readIdentifier("DATA",
LexicalUnits.NDATA_IDENTIFIER,
LexicalUnits.NAME);
case '"':
attrDelimiter = '"';
nextChar();
if (current == -1) {
throw createXMLException("unexpected.eof");
}
if (current != '"' && current != '&' && current != '%') {
do {
nextChar();
} while (current != -1 &&
current != '"' &&
current != '&' &&
current != '%');
}
switch (current) {
default:
throw createXMLException("invalid.character");
case '&':
case '%':
context = ENTITY_VALUE_CONTEXT;
break;
case '"':
nextChar();
return LexicalUnits.STRING;
}
return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT;
case '\'':
attrDelimiter = '\'';
nextChar();
if (current == -1) {
throw createXMLException("unexpected.eof");
}
if (current != '\'' && current != '&' && current != '%') {
do {
nextChar();
} while (current != -1 &&
current != '\'' &&
current != '&' &&
current != '%');
}
switch (current) {
default:
throw createXMLException("invalid.character");
case '&':
case '%':
context = ENTITY_VALUE_CONTEXT;
break;
case '\'':
nextChar();
return LexicalUnits.STRING;
}
return LexicalUnits.FIRST_ATTRIBUTE_FRAGMENT;
default:
return readName(LexicalUnits.NAME);
}
}