Skip to content

Recognize XML declarations after tab or newline whitespace - #37

Open
mamicicekel wants to merge 1 commit into
RazrFalcon:masterfrom
mamicicekel:fix/xml-decl-whitespace
Open

mamicicekel wants to merge 1 commit into
RazrFalcon:masterfrom
mamicicekel:fix/xml-decl-whitespace

Conversation

@mamicicekel

@mamicicekel mamicicekel commented Oct 28, 2026 •

Copy link
Copy Markdown

XML 1.0 defines XMLDecl as '<?xml' followed by VersionInfo, and VersionInfo starts with S (#x20 | #x9 | #xD | #xA). Detection used starts_with(b"<?xml "), so a declaration like <?xml\tversion='1.0'?> was parsed as a processing instruction named xml instead of a declaration.

<?xml-stylesheet is unchanged because the next byte is not whitespace.

XMLDecl is '<?xml' followed by S, and S includes tab, CR, and LF, not
only 0x20. The old `<?xml ` check parsed `<?xml\tversion=...` as a PI
named xml instead of a declaration, while `<?xml-stylesheet` is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant