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

Online demo does not handle DOCTYPE correctly and gives an error #627

Open
4 of 6 tasks
Edgar-P-yan opened this issue Dec 12, 2023 · 2 comments
Open
4 of 6 tasks

Comments

@Edgar-P-yan
Copy link

  • 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?

Description

Steps to reproduce:

  1. go to the online tool https://naturalintelligence.github.io/fast-xml-parser/
  2. no additional input needed, just click "Parse to JSON"
  3. then "Parse to XML"
  4. and again "Parse to JSON"
  5. it'll print Error: XML declaration allowed only at the start of the document.:2:6

I guess this is due to the { "?xml": "", ... } property, which converts to an invalid and duplicated doctype, resulting in an invalid XML:

<?xml version="1.0"?>
<?xml?>
<!-- ... the rest of the XML is valid -->

If i uncheck the "Ignore attributes" checkbox, then at the 2nd step i'll get a JSON that starts with this

{
    "?xml": {
        "@_version": "1.0"
    },

and when you convert it back to XML then you get a valid, but still duplicated doctype, which results in the same error:

<?xml version="1.0"?>
<?xml version="1.0"?>
<!-- ... the rest of the XML is valid -->

Code

The default XML sample that's in the online tool.

Output

expected data

Would you like to work on this issue?

  • Yes
  • No

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

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.

@amitguptagwl
Copy link
Member

Online demo was initially designed for just to demo some capabilities of the application to the new users without being aware with configuration. However, there are so many features added afterwards and it's difficult to cover them with simplified features, we may have to provide some option like "Advance usage" when user can type the configuration.

I am currently occupied in other things. So I would welcome PRs for this

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

No branches or pull requests

2 participants