Inconsistent handling of tags starting with digits (Parser accepts invalid XML)

Aperta
#1,035 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend

Direzione di ricerca

Start by reading the parser’s name handling and its existing XML well-formedness tests; the issue does not identify specific files or tests. Check how element names beginning with digits are accepted, then add coverage for the shown <1stElement> case and confirm parsing rejects it with an error. The expected behavior is strict validation of XML name rules.

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

Descrizione

enhancement

There is a critical inconsistency in how quick-xml handles tags that begin with digits. Because XML element naming rules (NCName constraints), these elements are problematic.

Currently:
The Parser is too permissive: It accepts XML that violates XML well-formedness rules (tags starting with digits).

This leads to a complete breakdown of interoperability and data integrity when round-tripping data through quick-xml.


Permissive Parsing

The parser accepts invalid XML where element tags values imply names starting with a digit. Standard-compliant parsers should handle these carefully, but quick-xml current behavior accepts them as valid XML data despite the underlying XML structure being potentially malformed or ambiguous.

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <!-- This tag name starts with '1', which is illegal. 
         Any conformant XML parser will reject this document. -->
    <1stElement>Data</1stElement>
</root>

Expected Behavior

Parser should strictly validate XML well-formedness. If a tag name violates XML naming rules, it should ideally raise an error or handle the namespace logic strictly according to the XML spec.

Lingua principale
Rust
Stelle
1.6k
Fork
299
Merge medio
2g 4h
PR unite (30g)
9

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 tafia/quick-xml

Tutte le issue di tafia/quick-xml

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.