fix: preserve carriage return characters in CDATA and text nodes#834
Open
kings9527 wants to merge 1 commit into
Open
fix: preserve carriage return characters in CDATA and text nodes#834kings9527 wants to merge 1 commit into
kings9527 wants to merge 1 commit into
Conversation
Remove the line that globally replaced \r and \r\n with \n in the input XML data. This replacement was incorrectly converting carriage returns inside CDATA sections and text nodes, which should be preserved as-is. The existing TODO comment even suggested removing this line. Closes NaturalIntelligence#512 - Removed: xmlData.replace(/\r\n?/g, "\n") from OrderedObjParser.js - Added unit test in cdata_spec.js to verify \r preservation in CDATA and text nodes - All 315 tests pass with this change
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.
Problem
Carriage Return characters () found within parsed XML are incorrectly converted to newline characters (). This happens because the parser globally replaces all sequences in the input XML data before parsing, including those inside CDATA sections and text nodes where they should be preserved.
The problematic line was:
This line was in and even had a TODO comment suggesting it should be removed.
Solution
Test Coverage
line1\rline2Closes #512
Checklist