fCharacterCounter++;
ch = loadNextChar();
if (ch != ']')
break;
if (fCurrentIndex + 1 == CharDataChunk.CHUNK_SIZE) {
CharDataChunk dataChunk = fCurrentChunk;
int index = fCurrentIndex;
int offset = fCurrentOffset;
if (loadNextChar() != '>') {
fCurrentChunk = dataChunk;
fCurrentIndex = index;
fCurrentOffset = offset;
fMostRecentData = dataChunk.toCharArray();
fMostRecentChar = ']';
break;
}
} else {
if (fMostRecentData[fCurrentIndex + 1] != '>')
break;
fCurrentIndex++;
fCurrentOffset++;
}
loadNextChar();
fCharacterCounter += 2;
return XMLEntityHandler.CONTENT_RESULT_END_OF_CDSECT;
case 4: // invalid char
if (ch == 0 && atEOF(fCurrentOffset + 1)) {
changeReaders();
return XMLEntityHandler.CONTENT_RESULT_INVALID_CHAR; // REVISIT - not quite...
}
return XMLEntityHandler.CONTENT_RESULT_INVALID_CHAR;
case 5:
do {
if (ch == 0x0A) {
fLinefeedCounter++;
fCharacterCounter = 1;
} else
fCharacterCounter++;
ch = loadNextChar();
} while (ch == 0x20 || ch == 0x09 || ch == 0x0A);
if (ch < 0x80) {
switch (XMLCharacterProperties.fgAsciiCharData[ch]) {
case 0:
fCharacterCounter++;
ch = loadNextChar();
break;
case 1: // '<'
if (!fInCDSect) {
callCharDataHandler(charDataOffset, fCurrentOffset, true);
fCharacterCounter++;
ch = loadNextChar();
return recognizeMarkup(ch);
}
fCharacterCounter++;
ch = loadNextChar();
break;
case 2: // '&'
if (!fInCDSect) {
callCharDataHandler(charDataOffset, fCurrentOffset, true);
fCharacterCounter++;
ch = loadNextChar();
return recognizeReference(ch);
}
fCharacterCounter++;
ch = loadNextChar();
break;
case 3: // ']'
int endOffset = fCurrentOffset;
ch = loadNextChar();
if (ch != ']') {
fCharacterCounter++;
break;
}
if (fCurrentIndex + 1 == CharDataChunk.CHUNK_SIZE) {
CharDataChunk dataChunk = fCurrentChunk;
int index = fCurrentIndex;
int offset = fCurrentOffset;
if (loadNextChar() != '>') {
fCurrentChunk = dataChunk;
fCurrentIndex = index;
fCurrentOffset = offset;
fMostRecentData = dataChunk.toCharArray();
fMostRecentChar = ']';
fCharacterCounter++;
break;
}
} else {
if (fMostRecentData[fCurrentIndex + 1] != '>') {
fCharacterCounter++;
break;
}
fCurrentIndex++;
fCurrentOffset++;
}
loadNextChar();
callCharDataHandler(charDataOffset, endOffset, true);
fCharacterCounter += 3;
return XMLEntityHandler.CONTENT_RESULT_END_OF_CDSECT;
case 4: // invalid char
callCharDataHandler(charDataOffset, fCurrentOffset, true);
if (ch == 0 && atEOF(fCurrentOffset + 1)) {
changeReaders();
return XMLEntityHandler.CONTENT_RESULT_INVALID_CHAR; // REVISIT - not quite...
}
return XMLEntityHandler.CONTENT_RESULT_INVALID_CHAR;
}
} else if (!skipMultiByteCharData(ch)) {
callCharDataHandler(charDataOffset, fCurrentOffset, true);
return XMLEntityHandler.CONTENT_RESULT_INVALID_CHAR;
}
break;
}
} else if (!skipMultiByteCharData(ch)) {
return XMLEntityHandler.CONTENT_RESULT_INVALID_CHAR;
}
ch = skipAsciiCharData();
while (true) {
if (ch < 0x80) {
switch (XMLCharacterProperties.fgAsciiCharData[ch]) {
case 0:
fCharacterCounter++;
ch = loadNextChar();
break;
case 1: // '<'
if (!fInCDSect) {
callCharDataHandler(charDataOffset, fCurrentOffset, false);
fCharacterCounter++;
ch = loadNextChar();
return recognizeMarkup(ch);
}
fCharacterCounter++;
ch = loadNextChar();
break;
case 2: // '&'
if (!fInCDSect) {
callCharDataHandler(charDataOffset, fCurrentOffset, false);
fCharacterCounter++;
ch = loadNextChar();
return recognizeReference(ch);
}
fCharacterCounter++;
ch = loadNextChar();
break;
case 3: // ']'
int endOffset = fCurrentOffset;
ch = loadNextChar();
if (ch != ']') {
fCharacterCounter++;
break;
}
if (fCurrentIndex + 1 == CharDataChunk.CHUNK_SIZE) {
CharDataChunk dataChunk = fCurrentChunk;
int index = fCurrentIndex;
int offset = fCurrentOffset;
if (loadNextChar() != '>') {
fCurrentChunk = dataChunk;
fCurrentIndex = index;
fCurrentOffset = offset;
fMostRecentData = dataChunk.toCharArray();
fMostRecentChar = ']';
fCharacterCounter++;
break;
}
} else {