question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Considers closing tag to be valid without closing bracket

See original GitHub issue

In its default configuration (and on your online tool), fast-xml-parser considers <test></test to be valid XML.

Checklist

  • Have you asked your question on Stackoverflow or similar forum?
  • 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?

Input

input data(one character at a time): <test></test

Code

validateXML(xml) {
   if (!!xml) console.log(xml, parser.validate(xml));
}

Output

< {err: {…}}
<t {err: {…}}
<te {err: {…}}
<tes {err: {…}}
<test {err: {…}}
<test> {err: {…}}
<test>< {err: {…}}
<test></ {err: {…}}
<test></t {err: {…}}
<test></te {err: {…}}
<test></tes {err: {…}}
<test></test true

expected data

.
.
.
<test></test {err: {…}}

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cliffhallcommented, Sep 17, 2019

For anyone running into this issue, here is the workaround I came up with for now:

const valid = !!xml && xml.trim().endsWith('>') && (parser.validate(xml) === true);

0reactions
amitguptagwlcommented, Oct 2, 2019

there were some misunderstandings in our conversation. Apologies not to understand it in the first place. However, I have fixed the bug you reported. Thanks for reporting

Read more comments on GitHub >

github_iconTop Results From Across the Web

fast-xml-parser considers closing tag to be valid without ...
Yes, I only observe the error on the closing tag at the end of the document. If there was a <test><test2></test2</test> it would...
Read more >
bracketSameLine should apply to closing as well as opening ...
It seems like in both cases, the closing bracket for the closing tag should be on the same line.
Read more >
Why the following XSS vectors work without closing bracket?
This essentially means that the full HTML element seen by the browser is starting with <svg and ending with > . The <...
Read more >
If both <br> and <br /> are valid syntaxes, which one should I ...
A Self-closing tag is a special form of start tag with a slash immediately before the closing right angle bracket. These indicate that...
Read more >
VS Code: You don't need that extension part 2 - Rob O'Leary
Take a look, you may not need that extension! ... If we have auto closing tags setting turned on, we may have to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found