null);
}
setScannerState(SCANNER_STATE_COMMENT);
} else if (fEntityScanner.skipString(DOCTYPE)) {
setScannerState(SCANNER_STATE_DOCTYPE);
Entity entity = fEntityScanner.getCurrentEntity();
if(entity instanceof Entity.ScannedEntity){
fStartPos=((Entity.ScannedEntity)entity).position;
}
fReadingDTD=true;
if(fDTDDecl == null)
fDTDDecl = new XMLStringBuffer();
fDTDDecl.append("<!DOCTYPE");
} else {
reportFatalError("MarkupNotRecognizedInProlog",
null);
}
} else if (XMLChar.isNameStart(fEntityScanner.peekChar())) {
setScannerState(SCANNER_STATE_ROOT_ELEMENT);
setDriver(fContentDriver);
//from now onwards this would be handled by fContentDriver,in the same next() call
return fContentDriver.next();
} else {
reportFatalError("MarkupNotRecognizedInProlog",
null);
}
break;
}
}
} while (fScannerState == SCANNER_STATE_PROLOG || fScannerState == SCANNER_STATE_START_OF_MARKUP );
switch(fScannerState){
/**
//this part is handled by FragmentContentHandler
case SCANNER_STATE_ROOT_ELEMENT: {
//we have read '<' and beginning of reading the start element tag
setScannerState(SCANNER_STATE_START_ELEMENT_TAG);
setDriver(fContentDriver);
//from now onwards this would be handled by fContentDriver,in the same next() call
return fContentDriver.next();
}
*/
case SCANNER_STATE_COMMENT: {
//this function fills the data..
scanComment();
setScannerState(SCANNER_STATE_PROLOG);
return XMLEvent.COMMENT;
//setScannerState(SCANNER_STATE_PROLOG);
//break;
}
case SCANNER_STATE_PI: {
fContentBuffer.clear() ;
scanPI(fContentBuffer);
setScannerState(SCANNER_STATE_PROLOG);
return XMLEvent.PROCESSING_INSTRUCTION;
}
case SCANNER_STATE_DOCTYPE: {
if (fSeenDoctypeDecl) {
reportFatalError("AlreadySeenDoctype", null);
}
fSeenDoctypeDecl = true;
// scanDoctypeDecl() sends XNI doctypeDecl event that
// in SAX is converted to startDTD() event.
if (scanDoctypeDecl(fDisallowDoctype)) {
//allow parsing of entity decls to continue in order to stay well-formed
setScannerState(SCANNER_STATE_DTD_INTERNAL_DECLS);
fSeenInternalSubset = true;
if(fDTDDriver == null){
fDTDDriver = new DTDDriver();
}
setDriver(fContentDriver);
//always return DTD event, the event however, will not contain any entities
return fDTDDriver.next();
// If no DTD support, ignore and continue parsing
//return fDisallowDoctype ? next() : dtdEvent;
}
if(fSeenDoctypeDecl){
Entity entity = fEntityScanner.getCurrentEntity();
if(entity instanceof Entity.ScannedEntity){
fEndPos = ((Entity.ScannedEntity)entity).position;
}
fReadingDTD = false;
}