question: public void tokenize ( InputSource is ) throws SAXException , IOException { if ( is == null ) { throw new IllegalArgumentException ( "InputSource was null." ) ; } tokenizer . start ( ) ; confidence = Confidence . TENTATIVE ; swallowBom = true ; rewindableInputStream = null ; tokenizer . initLocation ( is . getPublicId ( ) , is . getSystemId ( ) ) ; this . reader = is . getCharacterStream ( ) ; this . characterEncoding = encodingFromExternalDeclaration ( is . getEncoding ( ) ) ; if ( this . reader == null ) { InputStream inputStream = is . getByteStream ( ) ; if ( inputStream == null ) { throw new SAXException ( "Both streams in InputSource were null." ) ; } if ( this . characterEncoding == null ) { if ( allowRewinding ) { inputStream = rewindableInputStream = new RewindableInputStream ( inputStream ) ; } this . reader = new HtmlInputStreamReader ( inputStream , tokenizer . getErrorHandler ( ) , tokenizer , this , heuristics ) ; } else { becomeConfident ( ) ; this . reader = new HtmlInputStreamReader ( inputStream , tokenizer . getErrorHandler ( ) , tokenizer , this , this . characterEncoding ) ; } } else { becomeConfident ( ) ; } Throwable t = null ; try { for ( ; ; ) { try { for ( int i = 0 ; i < characterHandlers . length ; i ++ ) { CharacterHandler ch = characterHandlers [ i ] ; ch . start ( ) ; } runStates ( ) ; if ( confidence == Confidence . TENTATIVE && ! tokenizer . isAlreadyComplainedAboutNonAscii ( ) ) { warnWithoutLocation ( "The character encoding of the document was not declared." ) ; } break ; } catch ( ReparseException e ) { if ( rewindableInputStream == null ) { tokenizer . fatal ( "Changing encoding at this point would need non-streamable behavior." ) ; } else { rewindableInputStream . rewind ( ) ; becomeConfident ( ) ; this . reader = new HtmlInputStreamReader ( rewindableInputStream , tokenizer . getErrorHandler ( ) , tokenizer , this , this . characterEncoding ) ; } continue ; } } } catch ( Throwable tr ) { t = tr ; } finally { try { tokenizer . end ( ) ; characterEncoding = null ; for ( int i = 0 ; i < characterHandlers . length ; i ++ ) { CharacterHandler ch = characterHandlers [ i ] ; ch . end ( ) ; } reader . close ( ) ; reader = null ; rewindableInputStream = null ; } catch ( Throwable tr ) { if ( t == null ) { t = tr ; } } if ( t != null ) { if ( t instanceof IOException ) { throw ( IOException ) t ; } else if ( t instanceof SAXException ) { throw ( SAXException ) t ; } else if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } else if ( t instanceof Error ) { throw ( Error ) t ; } else { throw new RuntimeException ( t ) ; } } } }
target:  Runs the tokenization. This is the main entry point.