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

Invalid parsing of self-closing stopNode #435

Closed
5 of 6 tasks
diegone opened this issue Feb 20, 2022 · 1 comment
Closed
5 of 6 tasks

Invalid parsing of self-closing stopNode #435

diegone opened this issue Feb 20, 2022 · 1 comment

Comments

@diegone
Copy link

diegone commented Feb 20, 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

Using preserveOrder: true on a self-closing stopNode results in the tag emitted as a text node.

Code

const XMLParser = require('fast-xml-parser').XMLParser;
const parser = new XMLParser({preserveOrder: true, stopNodes: ["*.foo"]});
console.dir(parser.parse('<root><foo name="bar"/></root>'), { depth: null });

Output

[
  {
    root: [ { foo: [ { '#text': '' } ] }, { '#text': 'foo name="bar"/>' } ]
  }
]

Expected Output

[
  {
    root: [
      { foo: [ { '#text': '' } ] }
    ]
  }
]

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates.

@github-actions
Copy link

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.

diegone added a commit to l10nmonster/l10nmonster that referenced this issue Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant