Reader should be capable of transparent EOL normalization
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by tracing the Reader constructors and the XML content methods mentioned in the issue, then read XML 1.0 Section 2.11 and the linked follow-up issue. The proposed change spans buffering, decoding, normalization, zero-copy behavior, and compatibility for noncompliant input; define the desired API and tradeoffs before implementation. Done means reader behavior follows the selected XML specification consistently, with an explicit approach for disabling normalization where needed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Followup to https://github.com/tafia/quick-xml/issues/158
Per XML specification, all XML readers should perform line-ending normalization as a pre-processing step (or functionally behaving as if it were a pre-processing step - XML 1.0 Section 2.11)
This is both an ergonomic issue and also a minor correctness issue, because EOL normalization is blind to document contents and therefore also applies within elements, e.g. <?xml\r?> ought to be parsed as <?xml\n?> - which libxml2 does in fact do.
It's an ergonomic issue in the sense that a user should not need to care about it - the .xml_content(), .xml10_content(), .xml11_content() functions etc. ought to be superfluous and are potentially error prone. The user also shouldn't need to track the version declared in the declaration - they likely just want the document to be processed according to the correct specification per the declaration or according to the one they specify, but that need not change on a per-element basis.
Performing universal EOL normalization as a pre-processor pass through a bufffer would reduce total allocations and likely improve performance on average, while improving ergonomics and compliance.
The mechanism could also likely be used as a base upon which line/column tracking (https://github.com/tafia/quick-xml/issues/109) could be added.
Potentially troublesome aspects:
- For users who process noncompliant "almost-XML" documents that contain binary blobs, we would need a way to disable it, possibly document-wide, or perhaps just during the usage of
stream(). - We might want to make the current Reader constructors
from_reader(),from_str(),from_bytes()methods buffered by-default, and perhaps add a new constructor which takes only a pre-processedXmlDoctype or similar where decoding + normalization has already happened, allowing proper zero-copy. If we keep zero-copy (which isn't really zero-copy in practice) at all - maybe worth doing some benchmarking to see how much time is actually saved vs. just having a buffered path. XML parsing is easily 25-50x slower than copying the bytes around once or twice anyway, and theXmlSourcecode + macros are all quite complex.
- Lenguaje dominante
- Rust
- Estrellas
- 1.6k
- Forks
- 299
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tafia/quick-xml
-
Parser accepts an empty element or attribute namePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
DecodingReader::set_encoding panics when the XML declaration is longer than 64 bytesPosiblemente ocupada @emschwartz la tomó hace 4 días. Abiertobug encoding
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
tafia/quick-xml#1040 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
encoding optimization
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
tafia/quick-xml#1039 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
optimization question
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 1-2 días Aptitud para principiantes 53/100
tafia/quick-xml#1035 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de tafia/quick-xml
Issues similares
-
ライブラリを追加Abiertopriority middle
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
KATO-Hiro/AtCoderClans#13015 ·
Los mantenedores suelen responder en 1 día
-
needs-review
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
UCS-Care-Group/mailcraft#1429 ·
Los mantenedores suelen responder en 1 día
-
priority: medium ready
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
TusanHomichi/PSIV#646 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
area:tui bug P1
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
agent-of-empires/agent-of-empires#5705 · 1 comentario ·
Los mantenedores suelen responder en 1 día