Skip to content

Exception thrown by validator if unopened tag closes #573

@guillermoheras-bjss

Description

@guillermoheras-bjss
  • [ X ] Are you running the latest version?
  • [ X ] Have you included sample input, output, error, and expected output?
  • [ X ] Have you checked if you are using correct configuration?
  • [ X ] Did you try online tool? (getting the same error when parsing, the validation of the online tool outputs "Output")

Description

A closing tag that hasn't been opened causes an exception to be thrown, instead of returning a validation error (as would be expected)

Code

import { XMLValidator } from "fast-xml-parser";

// This throws an exception
XMLValidator.validate("<Document>some text</Document></badTag>");

Output

Exception thrown:

TypeError: Cannot read properties of undefined (reading 'tagName')
at exports.validate (/home/guillermoheras/lhv/banking-services/apps/portal/node_modules/fast-xml-parser/src/validator.js:108:33)

expected data

a ValidationError object should be returned

Would you like to work on this issue?

  • Yes
  • No

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PendingPending to be confirmed by user/author for some check/update/implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions