NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.58k stars 309 forks source link

Duplicate ?xml when rendering the document #689

Open ThePlenkov opened 2 weeks ago

ThePlenkov commented 2 weeks ago

Hi!

I'm testing it now using this page: https://naturalintelligence.github.io/fast-xml-parser/

I noticed that if I provide XML like this:

<?xml version="1.0" encoding="utf-8"?>
<test></test>

it generates me the JSON like this:

{
    "?xml": {
        "@_version": "1.0",
        "@_encoding": "utf-8"
    },
    "test": ""
}

now when I render XML again I have ?xml node described twice:

<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<test></test>

and if I parse such XML of course it fails.

Could you please check why? Is it a bug of the library or just the UI issue? Thanks!

github-actions[bot] commented 2 weeks ago

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 commented 2 weeks ago

This is just in demo, not the library bug.

ThePlenkov commented 2 weeks ago

yes, I can confirm! it works as expected in the code. thanks. anyway - would be nice to fix the demo if possible,