Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Online demo does not handle DOCTYPE correctly and gives an error

Aperta
#627 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
frontend, web-dev

Direzione di ricerca

Inizia con lo strumento online all’indirizzo https://naturalintelligence.github.io/fast-xml-parser/ e riproduci la sequenza documentata „Parse to JSON“, „Parse to XML“ e „Parse to JSON“ usando il relativo esempio XML predefinito. Il lavoro è completato quando il round trip non segnala più l’errore relativo alla dichiarazione XML e non produce una dichiarazione duplicata; nell’issue non sono indicati file sorgente né test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
JavaScript
Stelle
3.1k
Fork
398
Merge medio
2g 14h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NaturalIntelligence/fast-xml-parser

Tutte le issue di NaturalIntelligence/fast-xml-parser

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.