Considers closing tag to be valid without closing bracket
See original GitHub issueIn 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:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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);
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