Open asthaaaaaa opened 1 year ago
Try to validate this XML<note><?xml version="1.0" encoding="utf-8"?>test</note>
<note><?xml version="1.0" encoding="utf-8"?>test</note>
XMLValidator.validate(`<note><?xml version="1.0" encoding="utf-8"?>test</note>`)
XMLValidator returns true
XMLValidator.validate should return error with message XML declaration allowed only at the start of the document. https://github.com/NaturalIntelligence/fast-xml-parser/blob/3c9e9fe4346a3c9924d4db45e60a7a29c565caac/src/validator.js#L206C46-L206C104
XML declaration allowed only at the start of the document.
Additional Notes: https://github.com/NaturalIntelligence/fast-xml-parser/blob/3c9e9fe4346a3c9924d4db45e60a7a29c565caac/src/validator.js#L204 is the Root cause of the issue, as start = i in our case and tagname become ""
start = i
tagname
""
Would you like to work on this issue?
Bookmark this repository for further updates. Visit SoloThought to know about recent features.
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.
Description
### InputTry to validate this XML
<note><?xml version="1.0" encoding="utf-8"?>test</note>
Code
Output
XMLValidator returns true
expected data
XMLValidator.validate should return error with message
XML declaration allowed only at the start of the document.
https://github.com/NaturalIntelligence/fast-xml-parser/blob/3c9e9fe4346a3c9924d4db45e60a7a29c565caac/src/validator.js#L206C46-L206C104Additional Notes: https://github.com/NaturalIntelligence/fast-xml-parser/blob/3c9e9fe4346a3c9924d4db45e60a7a29c565caac/src/validator.js#L204 is the Root cause of the issue, as
start = i
in our case andtagname
become""
Would you like to work on this issue?
Bookmark this repository for further updates. Visit SoloThought to know about recent features.