Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while parsing quotes in CDATA in a stop node #472

Closed
5 of 6 tasks
diegone opened this issue Jul 6, 2022 · 0 comments
Closed
5 of 6 tasks

Exception while parsing quotes in CDATA in a stop node #472

diegone opened this issue Jul 6, 2022 · 0 comments
Labels
Pending Pending to be confirmed by user/author for some check/update/implementation

Comments

@diegone
Copy link

diegone commented Jul 6, 2022

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?

Description

Getting an exception in the specified scenario.

Input

<a>
  <b><![CDATA[']]></b>
  <b>'</b>
</a>

Code

const XMLParser = require('fast-xml-parser').XMLParser;
const parser = new XMLParser({ stopNodes: ["*.b"] });
console.dir(parser.parse("<a><b><![CDATA[']]></b><b>'</b></a>"));

Output

node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js:299
            if(!result) throw new Error(`Unexpected end of ${tagName}`);
                        ^
Error: Unexpected end of b
    at OrderedObjParser.parseXml (node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js:299:31)
    at XMLParser.parse (node_modules/fast-xml-parser/src/xmlparser/XMLParser.js:35:48)

expected data

{ a: { b: [ "'", "'" ] } }

Would you like to work on this issue?

  • Yes
  • No
@amitguptagwl amitguptagwl added the Pending Pending to be confirmed by user/author for some check/update/implementation label Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending Pending to be confirmed by user/author for some check/update/implementation
Projects
None yet
Development

No branches or pull requests

2 participants