Skip to content

Parse processing instructions outside the XML prolog - #1107

Open
fly1d wants to merge 1 commit into
leethomason:masterfrom
fly1d:fix/processing-instructions
Open

fly1d wants to merge 1 commit into
leethomason:masterfrom
fly1d:fix/processing-instructions

Conversation

@fly1d

@fly1d fly1d commented Oct 28, 2026

Copy link
Copy Markdown

Fixes #777.

A processing instruction such as <?pi_target pi_content?> parses in the prolog, but fails inside an element or after the root/comment. Keep its existing XMLDeclaration representation and exempt valid non-reserved PI targets from the declaration location checks. The existing name helpers identify the target; only XML whitespace can separate it from its data. All eight case variants of the reserved xml target retain the original checks.

The older fork workaround linked in #777 removes the declaration location checks. This change retains those checks and their tests, with controls for malformed targets and unchanged opaque prolog handling.

Tested with Apple Clang 21 on macOS arm64:

  • CMake/CTest passes for static/shared libraries in Debug/Release, plus the four installed-package consumers.
  • AddressSanitizer and UndefinedBehaviorSanitizer Debug build passes.
  • The final tests fail at 14 PI parse/reparse assertions with the original source. The fixed xmltest reports 658 passing assertions, 0 failures; assertions after successful parses account for the different totals.

This branch has not been deployed

No deployments
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.

Parsing fails because of processing instruction

1 participant