ixml parser: read a CDATA section - #1229
Merged
larshp merged 1 commit intoSep 15, 2026
Merged
Conversation
Member
|
conflicts |
oblomov-dev
force-pushed
the
claude/nifty-meitner-ema3y8-cdata
branch
from
September 15, 2026 11:36
702ee68 to
500cbb6
Compare
Member
|
conflicts |
A document that carries one did not parse: "<![CDATA[" enters the branch for a start or close tag, the tag regex does not match it and the parse dies in `ASSERT ls_match-offset = 0` - an assertion, so no CATCH cx_root absorbs it, and a section is the one form in which markup characters may stand in a document as text. The loop now takes a section ahead of the tag branch: everything up to "]]>" becomes the value of a #text node, as it stands. Nothing in it is unescaped, which is what the section is for. Tests: markup characters inside a section, an entity that stays text, a line break, and an empty section. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKSWLpid4QLV6XWAoPixbb
oblomov-dev
force-pushed
the
claude/nifty-meitner-ema3y8-cdata
branch
from
September 15, 2026 11:52
500cbb6 to
b4a1da3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
A document that carries a CDATA section does not parse.
<![CDATA[falls intothe branch for a start or close tag, where the tag regex does not match it:
so the parse ends in
ASSERTION_FAILED. That is an assertion, not anexception — no
CATCH cx_rootaround the parse absorbs it, the caller has noway to handle the document at all:
A section is the one form in which
<and&may stand in a document astext, so it is what a producer reaches for whenever a value carries markup —
an embedded XML or HTML fragment, a snippet of source code, a serialized
payload inside a field.
The change
The loop takes a section ahead of the tag branch: everything between
<![CDATA[and]]>becomes the value of a#textnode, exactly as itstands. Nothing in it is unescaped — that is what the section is for, an
<inside one is the four characters<and not<.A document without a section is not touched — the new branch is only reached
by the literal
<![CDATA[.Tests
parse_cdata—<![CDATA[a<b&c]]>reads asa<b&cparse_cdata_not_unescaped—<![CDATA[a<b]]>staysa<bparse_cdata_newline— a line break inside a section survivesparse_cdata_empty—<![CDATA[]]>is an empty value, not a failurenpm testis green:abaplint: 0 issue(s) found, 735 file(s) analyzed, andthe full unit run passes.
Not in this PR
A comment fails the same way and for the same reason —
<!-- c -->reachesthe tag branch and ends in
ASSERTION_FAILED(measured on this branch). Itwants its own change: a comment is skipped rather than turned into a node,
and it may sit before the root element, where a section may not.