NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.43k stars 297 forks source link

Entities are being processed in CDATA sections #632

Closed mwardle closed 5 months ago

mwardle commented 6 months ago

Description

Entities are being processed in CDATA sections which appears to be incorrect. A previous issue (#40) provides discussion related to this issue. It appears that this issue was fixed in Version 3 and reintroduced in Version 4. To avoid a breaking change, adding an option to prevent entities from being processed within CDATA sections could be appropriate.

Input

Code

const options = {
  ignoreDeclaration: true,
  processEntities: true,
}
new (XMLParser(options)).parse(`<Root><a>test&gt;</a><b><![CDATA[test&gt;]]></b></Root>`)

Output

{ Root: { a: 'test>', b: 'test>' } }

expected data

{ Root: { a: 'test>', b: 'test&gt;' } }

Would you like to work on this issue?

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

github-actions[bot] commented 6 months ago

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.