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.49k stars 302 forks source link

Parser gets confused when tags contain values with < characters #528

Closed mstn closed 1 year ago

mstn commented 1 year ago

Description

Input where values have some special characters, e.g. <.

<math>
        <variable>x</variable>
        <operation><=</operation>
        <value>10</value>
</math>

Output

Value '<=is interpreted as<` (tag start) and '=', resulting in incorrect output

{ math: { variable: 'x', operation: { '=</operation': ...} } }

Code

https://github.com/mstn/fast-xml-parser-poc

github-actions[bot] commented 1 year ago

I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.

amitguptagwl commented 1 year ago

As per the XML specification < can't be used in content directly. Hence, it is not supported. Please use &lt.