public boolean dispatch(boolean complete)
throws IOException, XNIException {
fEntityManager.setEntityHandler(null);
try {
boolean again;
XMLResourceIdentifierImpl resourceIdentifier = new XMLResourceIdentifierImpl();
do {
again = false;
switch (fScannerState) {
case SCANNER_STATE_DTD_INTERNAL_DECLS: {
// REVISIT: Should there be a feature for
// the "complete" parameter?
boolean completeDTD = true;
boolean moreToScan = fDTDScanner.scanDTDInternalSubset(completeDTD, fStandalone, fHasExternalDTD && fLoadExternalDTD);
if (!moreToScan) {
// end doctype declaration
if (!fEntityScanner.skipChar(']')) {
reportFatalError("EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET",
null);
}
fEntityScanner.skipSpaces();
if (!fEntityScanner.skipChar('>')) {
reportFatalError("DoctypedeclUnterminated", new Object[]{fDoctypeName});
}
fMarkupDepth--;
// scan external subset next
if (fDoctypeSystemId != null && (fValidation || fLoadExternalDTD)
&& (fValidationManager == null || !fValidationManager.isCachedDTD())) {
setScannerState(SCANNER_STATE_DTD_EXTERNAL);
}
// break out of here
else {
setScannerState(SCANNER_STATE_PROLOG);
setDispatcher(fPrologDispatcher);
fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
return true;
}
}
break;
}
case SCANNER_STATE_DTD_EXTERNAL: {
resourceIdentifier.setValues(fDoctypePublicId, fDoctypeSystemId, null, null);
XMLInputSource xmlInputSource =
fEntityManager.resolveEntity(resourceIdentifier);
fDTDScanner.setInputSource(xmlInputSource);
setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS);
again = true;