Inconsistent handling of tags starting with digits (Parser accepts invalid XML)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 53/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 299
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- No 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 tafia/quick-xml
-
Parser accepts an empty element or attribute namePossibly taken @ychampion claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
DecodingReader::set_encoding panics when the XML declaration is longer than 64 bytesPossibly taken @emschwartz claimed this 4 days ago. Openbug encoding
Difficulty 4/5 3-5 days Newbie friendliness 30/100
tafia/quick-xml#1040 · 1 comment ·
Maintainers usually reply within 1 day
-
encoding optimization
Difficulty 4/5 3-5 days Newbie friendliness 55/100
tafia/quick-xml#1039 · 1 comment ·
Maintainers usually reply within 1 day
-
optimization question
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
storytold/photocraft#14822 ·
Maintainers usually reply within 1 day
-
bug css
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
dginev/latexml-oxide#853 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
[Bug] export_build_environment admits its output directory only after the export ran in the build computerPossibly taken @viniciusdsandrade claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day