Closed AllanZhengYP closed 1 year ago
The predefined entity seems to be parsed twice. &lt; is expected to be parsed to $lt;. However, it is parsed again to <
&lt;
$lt;
<
<SimpleScalarPropertiesInputOutput> <stringValue>&lt;</stringValue> </SimpleScalarPropertiesInputOutput>
import { XMLParser } from "fast-xml-parser"; const encoded = `<SimpleScalarPropertiesInputOutput> <stringValue>&lt;</stringValue> </SimpleScalarPropertiesInputOutput>`; const parser = new XMLParser({}) const parsed = parser.parse(encoded); console.log(JSON.stringify(parsed, null, 2));
{ "SimpleScalarPropertiesInputOutput": { "stringValue": "<" } }
{ "SimpleScalarPropertiesInputOutput": { "stringValue": "<" } }
Would you like to work on this issue?
It seems to be caused by replacing the escaped value with entity regex in a loop: https://github.com/NaturalIntelligence/fast-xml-parser/blob/443e8edaf94bb1e65738cd73aa32c9d5fa06a927/src/xmlparser/OrderedObjParser.js#L372-L375
Hi @amitguptagwl, is there any update?
Description
The predefined entity seems to be parsed twice.
&lt;
is expected to be parsed to$lt;
. However, it is parsed again to<
Input
Code
Output
expected data
Would you like to work on this issue?
It seems to be caused by replacing the escaped value with entity regex in a loop: https://github.com/NaturalIntelligence/fast-xml-parser/blob/443e8edaf94bb1e65738cd73aa32c9d5fa06a927/src/xmlparser/OrderedObjParser.js#L372-L375