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

TypeError: Cannot read properties of undefined (reading 'tagName') when parsing closing tag without an opening tag at the start of XML document #620

Closed
5 of 6 tasks
lulunac27a opened this issue Oct 25, 2023 · 3 comments · Fixed by #647
Labels

Comments

@lulunac27a
Copy link

lulunac27a commented Oct 25, 2023

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

Description

I got an error saying TypeError: Cannot read properties of undefined (reading 'tagName') when I put closing tag at the start of XML document

Input

</a>

Code

new XMLParser().parse('</a>');
XMLValidator().validate('</a>');

Output

TypeError: Cannot read properties of undefined (reading 'tagName')

expected data

Error: closing tag found at start of XML document
Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

@github-actions
Copy link

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

@AirOne01
Copy link

AirOne01 commented Mar 1, 2024

I can confirm the bug and reproduce.

@MaelAbgrall
Copy link

MaelAbgrall commented Mar 2, 2024

I came here after a bug in prod that had the trace stating the same thing.

However, using lulunac27a example, I can only reproduce it in the online editor, can't on my dev machine with package version 4.3.5 and 4.3.4.

The trace I got from logs in prod is:

TypeError: Cannot read properties of undefined (reading 'tagName')
    at OrderedObjParser.parseXml (/backend/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js:281:29)
    at XMLParser.parse (/backend/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js:35:48)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@amitguptagwl @AirOne01 @MaelAbgrall @lulunac27a and others