@Override public boolean dispatch(boolean complete) throws IOException, XNIException {
  try {
    boolean again;
    do {
      again=false;
switch (fScannerState) {
case SCANNER_STATE_CONTENT:
{
          if (fEntityScanner.skipChar('<')) {
            setScannerState(SCANNER_STATE_START_OF_MARKUP);
            again=true;
          }
 else           if (fEntityScanner.skipChar('&')) {
            setScannerState(SCANNER_STATE_REFERENCE);
            again=true;
          }
 else {
            do {
              int c=scanContent();
              if (c == '<') {
                fEntityScanner.scanChar();
                setScannerState(SCANNER_STATE_START_OF_MARKUP);
                break;
              }
 else               if (c == '&') {
                fEntityScanner.scanChar();
                setScannerState(SCANNER_STATE_REFERENCE);
                break;
              }
 else               if (c != -1 && isInvalidLiteral(c)) {
                if (XMLChar.isHighSurrogate(c)) {
                  fStringBuffer.clear();
                  if (scanSurrogates(fStringBuffer)) {
                    if (fDocumentHandler != null) {
                      fDocumentHandler.characters(fStringBuffer,null);
                    }
                  }
                }
 else {
                  reportFatalError("InvalidCharInContent",new Object[]{Integer.toString(c,16)});
                  fEntityScanner.scanChar();
                }
              }
            }
 while (complete);
          }
          break;
        }
case SCANNER_STATE_START_OF_MARKUP:
{
        fMarkupDepth++;
        if (fEntityScanner.skipChar('/')) {
          if (scanEndElement() == 0) {
            if (elementDepthIsZeroHook()) {
              return true;
            }
          }
          setScannerState(SCANNER_STATE_CONTENT);
        }
 else         if (isValidNameStartChar(fEntityScanner.peekChar())) {
          scanStartElement();
          setScannerState(SCANNER_STATE_CONTENT);
        }
 else         if (fEntityScanner.skipChar('!')) {
          if (fEntityScanner.skipChar('-')) {
            if (!fEntityScanner.skipChar('-')) {
              reportFatalError("InvalidCommentStart",null);
            }
            setScannerState(SCANNER_STATE_COMMENT);
            again=true;
          }
 else           if (fEntityScanner.skipString("[CDATA[")) {
            setScannerState(SCANNER_STATE_CDATA);
            again=true;
          }
 else           if (!scanForDoctypeHook()) {
            reportFatalError("MarkupNotRecognizedInContent",null);
          }
        }
 else         if (fEntityScanner.skipChar('?')) {
          setScannerState(SCANNER_STATE_PI);
          again=true;
        }
 else         if (isValidNameStartHighSurrogate(fEntityScanner.peekChar())) {
          scanStartElement();
          setScannerState(SCANNER_STATE_CONTENT);
        }
 else {
          reportFatalError("MarkupNotRecognizedInContent",null);
          setScannerState(SCANNER_STATE_CONTENT);
        }
        break;
      }
case SCANNER_STATE_COMMENT:
{
      scanComment();
      setScannerState(SCANNER_STATE_CONTENT);
      break;
    }
case SCANNER_STATE_PI:
{
    scanPI();
    setScannerState(SCANNER_STATE_CONTENT);
    break;
  }
case SCANNER_STATE_CDATA:
{
  scanCDATASection(complete);
  setScannerState(SCANNER_STATE_CONTENT);
  break;
}
case SCANNER_STATE_REFERENCE:
{
fMarkupDepth++;
setScannerState(SCANNER_STATE_CONTENT);
if (fEntityScanner.skipChar('#')) {
  scanCharReference();
}
 else {
  scanEntityReference();
}
break;
}
case SCANNER_STATE_TEXT_DECL:
{
if (fEntityScanner.skipString("<?xml")) {
fMarkupDepth++;
if (isValidNameChar(fEntityScanner.peekChar())) {
  fStringBuffer.clear();
  fStringBuffer.append("xml");
  if (fNamespaces) {
    while (isValidNCName(fEntityScanner.peekChar())) {
      fStringBuffer.append((char)fEntityScanner.scanChar());
    }
  }
 else {
    while (isValidNameChar(fEntityScanner.peekChar())) {
      fStringBuffer.append((char)fEntityScanner.scanChar());
    }
  }
  String target=fSymbolTable.addSymbol(fStringBuffer.ch,fStringBuffer.offset,fStringBuffer.length);
  scanPIData(target,fTempString);
}
 else {
  scanXMLDeclOrTextDecl(true);
}
}
fEntityManager.fCurrentEntity.mayReadChunks=true;
setScannerState(SCANNER_STATE_CONTENT);
break;
}
case SCANNER_STATE_ROOT_ELEMENT:
{
if (scanRootElementHook()) {
return true;
}
setScannerState(SCANNER_STATE_CONTENT);
break;
}
case SCANNER_STATE_DOCTYPE:
{
reportFatalError("DoctypeIllegalInContent",null);
setScannerState(SCANNER_STATE_CONTENT);
}
}
}
 while (complete || again);
}
 catch (MalformedByteSequenceException e) {
fErrorReporter.reportError(e.getDomain(),e.getKey(),e.getArguments(),XMLErrorReporter.SEVERITY_FATAL_ERROR,e);
return false;
}
catch (CharConversionException e) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"CharConversionFailure",null,XMLErrorReporter.SEVERITY_FATAL_ERROR,e);
return false;
}
catch (EOFException e) {
endOfFileHook(e);
return false;
}
return true;
}

@ Override public boolean dispatch ( boolean complete ) throws IOException , XNIException { try { boolean again ; do { again = false ; switch ( fScannerState ) { case SCANNER_STATE_CONTENT : { if ( fEntityScanner . skipChar ( '<' ) ) { setScannerState ( SCANNER_STATE_START_OF_MARKUP ) ; again = true ; } else if ( fEntityScanner . skipChar ( '&' ) ) { setScannerState ( SCANNER_STATE_REFERENCE ) ; again = true ; } else { do { int c = scanContent ( ) ; if ( c == '<' ) { fEntityScanner . scanChar ( ) ; setScannerState ( SCANNER_STATE_START_OF_MARKUP ) ; break ; } else if ( c == '&' ) { fEntityScanner . scanChar ( ) ; setScannerState ( SCANNER_STATE_REFERENCE ) ; break ; } else if ( c != - 1 && isInvalidLiteral ( c ) ) { if ( XMLChar . isHighSurrogate ( c ) ) { fStringBuffer . clear ( ) ; if ( scanSurrogates ( fStringBuffer ) ) { if ( fDocumentHandler != null ) { fDocumentHandler . characters ( fStringBuffer , null ) ; } } } else { reportFatalError ( "InvalidCharInContent" , new Object [ ] { Integer . toString ( c , 16 ) } ) ; fEntityScanner . scanChar ( ) ; } } } while ( complete ) ; } break ; } case SCANNER_STATE_START_OF_MARKUP : { fMarkupDepth ++ ; if ( fEntityScanner . skipChar ( '/' ) ) { if ( scanEndElement ( ) == 0 ) { if ( elementDepthIsZeroHook ( ) ) { return true ; } } setScannerState ( SCANNER_STATE_CONTENT ) ; } else if ( isValidNameStartChar ( fEntityScanner . peekChar ( ) ) ) { scanStartElement ( ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; } else if ( fEntityScanner . skipChar ( '!' ) ) { if ( fEntityScanner . skipChar ( '-' ) ) { if ( ! fEntityScanner . skipChar ( '-' ) ) { reportFatalError ( "InvalidCommentStart" , null ) ; } setScannerState ( SCANNER_STATE_COMMENT ) ; again = true ; } else if ( fEntityScanner . skipString ( "[CDATA[" ) ) { setScannerState ( SCANNER_STATE_CDATA ) ; again = true ; } else if ( ! scanForDoctypeHook ( ) ) { reportFatalError ( "MarkupNotRecognizedInContent" , null ) ; } } else if ( fEntityScanner . skipChar ( '?' ) ) { setScannerState ( SCANNER_STATE_PI ) ; again = true ; } else if ( isValidNameStartHighSurrogate ( fEntityScanner . peekChar ( ) ) ) { scanStartElement ( ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; } else { reportFatalError ( "MarkupNotRecognizedInContent" , null ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; } break ; } case SCANNER_STATE_COMMENT : { scanComment ( ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; break ; } case SCANNER_STATE_PI : { scanPI ( ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; break ; } case SCANNER_STATE_CDATA : { scanCDATASection ( complete ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; break ; } case SCANNER_STATE_REFERENCE : { fMarkupDepth ++ ; setScannerState ( SCANNER_STATE_CONTENT ) ; if ( fEntityScanner . skipChar ( '#' ) ) { scanCharReference ( ) ; } else { scanEntityReference ( ) ; } break ; } case SCANNER_STATE_TEXT_DECL : { if ( fEntityScanner . skipString ( "<?xml" ) ) { fMarkupDepth ++ ; if ( isValidNameChar ( fEntityScanner . peekChar ( ) ) ) { fStringBuffer . clear ( ) ; fStringBuffer . append ( "xml" ) ; if ( fNamespaces ) { while ( isValidNCName ( fEntityScanner . peekChar ( ) ) ) { fStringBuffer . append ( ( char ) fEntityScanner . scanChar ( ) ) ; } } else { while ( isValidNameChar ( fEntityScanner . peekChar ( ) ) ) { fStringBuffer . append ( ( char ) fEntityScanner . scanChar ( ) ) ; } } String target = fSymbolTable . addSymbol ( fStringBuffer . ch , fStringBuffer . offset , fStringBuffer . length ) ; scanPIData ( target , fTempString ) ; } else { scanXMLDeclOrTextDecl ( true ) ; } } fEntityManager . fCurrentEntity . mayReadChunks = true ; setScannerState ( SCANNER_STATE_CONTENT ) ; break ; } case SCANNER_STATE_ROOT_ELEMENT : { if ( scanRootElementHook ( ) ) { return true ; } setScannerState ( SCANNER_STATE_CONTENT ) ; break ; } case SCANNER_STATE_DOCTYPE : { reportFatalError ( "DoctypeIllegalInContent" , null ) ; setScannerState ( SCANNER_STATE_CONTENT ) ; } } } while ( complete || again ) ; } catch ( MalformedByteSequenceException e ) { fErrorReporter . reportError ( e . getDomain ( ) , e . getKey ( ) , e . getArguments ( ) , XMLErrorReporter . SEVERITY_FATAL_ERROR , e ) ; return false ; } catch ( CharConversionException e ) { fErrorReporter . reportError ( XMLMessageFormatter . XML_DOMAIN , "CharConversionFailure" , null , XMLErrorReporter . SEVERITY_FATAL_ERROR , e ) ; return false ; } catch ( EOFException e ) { endOfFileHook ( e ) ; return false ; } return true ; }
dispatch an xml " event " .
