feat(std/xml): XML tree, reader and writer (step 1 of #78) #431
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/429-std-xml"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #429
Task
Step 1 of #78:
std/xmlwith a tree, a reader and a writer, as specified in #429.What
std/xml:Xml(parse,write,indent), the treeXmlNode/XmlName/XmlAttribute/XmlDeclaration, andXmlErrorwith line and column. XML 1.0 (fifth edition) with Namespaces in XML 1.0; names are resolved while reading, namespace declarations stay attributes so the writer writes back what the document declared.parse(write(parse(text))) == parse(text).&,--in a comment, plus the namespace constraints (reserved prefixes, no prefix undeclaring, unique expanded attribute names).Doctypenode; with one it is anXmlErrorat the[. Nothing external is ever fetched or opened, and only the five predefined entities and character references are read (no entity expansion).docs/standard-library/xml.md(with atrb checkexample parsing an S3ListBucketResult), listed in the standard library index;skills/regenerated. ENCODING.md slice 8 is marked in progress with two entries in section 16 (the tree, the DOCTYPE rule). The CONCEPT.md sentence that gave document formats their own traits is reconciled with ENCODING.md: no format gets a trait of its own.Conformance cases
The W3C XML Conformance Test Suite is not vendored: James Clark's part allows only unmodified redistribution, Sun's is "All Rights Reserved" and IBM's grants no redistribution. So
std/xml/testsholds hand-written cases per production of XML 1.0 and Namespaces in XML 1.0 (conformance-cases.trb: 82 well-formed and 195 not well-formed documents, each naming its production or constraint), with the reasoning intests/NOTICE.md, plusxml.test.trbfor the tree, names, entities, errors with positions, DOCTYPE, writing and the round trip.Test
Locally, with a nightly
torb(no bootstrap, no gates):torb check std/xml(no problems),torb format --check std/xml(clean),torb test std/xml/tests(331 passed, 0 failed),torb doc --check --no-run std/xml(no problems),torb docs declarations docs,torb docs index docs --checkandtorb docs skill docs skills --check(all up to date).torb docs check docsreports only three problems that do not come from this change: no C compiler for thetrb runblocks here, and twostd/clisnippets the nightly cannot infer. Gates run in forge CI (tier A).seed/is not touched; the compiler does not importstd/xml.std/xmltree, reader and writer (step 1 of #78) #429Checklist for
f8aa89e(CI combined status success: tier A, tier B, gates, pdisc, bootstrap):Charproduction checked), namespace constraints (reserved prefixes, no undeclaring, unique expanded attribute names), depth limit, internal-subset DOCTYPE refused, no entity expansion; the writer refuses what the reader would refuse and declares missing namespaces.seed/untouched. Hand-written cases instead of the W3C suite is the fallback #429 names, and NOTICE.md records the licence reasoning.docs/standard-library/xml.md, index entries, regeneratedskills/, ENCODING.md slice 8; pdisc check green.Non-blocking:
Xml.write: if a hand-built element carries anxmlns:pattribute and one of its names needs a different binding forp,declareadds a secondxmlns:pand the output has a duplicate attribute (theseencheck covers only the attributes, not the added declarations). Trees made byparsecannot hit this.