If the DTD build flag's set it there's a whole suite of states for parsing that DTD prologue. I won't discuss further, since I've got enough already!
There's a wrapper around callbacks for handling text encodings. There's a wrapper around one of 2 XML declaration lexers which additionally copies data into memory that's not about to be freed, while handling those text encodings.
There's another wrapper around the callbacks for unknown encodings.
These are used in the starting parser state.
2/?
The 2nd state invokes a custom lexer & (via a helper with its lookuptables) normalizes its input & repeatedly branches over tokens with validation. Usually it practically ignores the tokens though it might hand off to the DTD parser. Afterwords it branches over the final token to determine which state to carefully hand off to next. This branch is *very* extensive!
Once the last tag's closed the primary state hands off to an epilog parser.
3/?
+1.00 90.33