Online demo does not handle DOCTYPE correctly and gives an error
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
Research direction
Start with the online tool at https://naturalintelligence.github.io/fast-xml-parser/ and reproduce the documented Parse to JSON, Parse to XML, and Parse to JSON sequence using its default XML sample. Done means the round trip no longer reports the XML declaration error or produces a duplicated declaration; no source file or test is named in the issue.
Written by the indexing model from the issue text.
Description
- 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:
- go to the online tool https://naturalintelligence.github.io/fast-xml-parser/
- no additional input needed, just click "Parse to JSON"
- then "Parse to XML"
- and again "Parse to JSON"
- 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.
- Dominant language
- JavaScript
- Stars
- 3.1k
- Forks
- 410
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NaturalIntelligence/fast-xml-parser
-
A processing instruction with no target passes validation, then the builder prints invalid XMLPossibly taken @bardrop claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NaturalIntelligence/fast-xml-parser#927 · 2 comments ·
Maintainers usually reply within 4 days
-
XMLValidator accepts double hyphens inside commentsPossibly taken @Sskift claimed this 16 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NaturalIntelligence/fast-xml-parser#903 · 3 comments ·
Maintainers usually reply within 4 days
-
XMLValidator accepts raw < and & in attribute valuesPossibly taken @jeromeyyy claimed this 14 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NaturalIntelligence/fast-xml-parser#900 · 3 comments ·
Maintainers usually reply within 4 days
-
getMetaDataSymbol() declares a boxed SymbolPossibly taken @chiragbitoni claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
NaturalIntelligence/fast-xml-parser#890 · 1 comment ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NaturalIntelligence/fast-xml-parser#888 · 2 comments ·
Maintainers usually reply within 4 days
All issues in NaturalIntelligence/fast-xml-parser
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
Extended search drops any query term that contains a line breakPossibly taken @goranai claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day