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

Abierto
#1,035 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
53/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
1.6k
Forks
299
Merge medio
2 d 4 h
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de tafia/quick-xml

Todos los issues de tafia/quick-xml

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.