fix: render true booleans as "true" in XML output#1200
Conversation
✨ Highlights
🧾 Changes by Scope
🔝 Top Files
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1200 +/- ##
========================================
Coverage 82.12% 82.12%
========================================
Files 33 33
Lines 3149 3149
Branches 734 734
========================================
Hits 2586 2586
Misses 387 387
Partials 176 176
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
An automated preview of the documentation is available at https://1200.mrdocs.prtest2.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-05-20 07:43:51 UTC |
530b6d2 to
bd82635
Compare
bd82635 to
c8905c4
Compare
The XML writer emitted true boolean members as `<x>1</x>` (and omitted the element when false). It now emits the xsd:boolean primary lexical form, `<x>true</x>`. The omit-when-false convention is preserved, so the golden XMLs change only in the body of already-present boolean elements. The RELAX NG schema is updated accordingly.
c8905c4 to
2b9534e
Compare
I'm no XML expert, but that seems like a weird convention to make. If we omit when false, this is technically a flag. And flags don't have to say "true". I thought booleans were typically represented as attributes in XML. |
I was going to point out the same.
Yes. For us, the form would be something like: The MrDocs schema currently has almost no data attributes, so booleans-as-elements is at least consistent. I'd suggest switching to "empty element (e.g. |
The XML writer emitted true boolean members as
<x>1</x>(and omitted the element when false). It now emits the xsd:boolean primary lexical form,<x>true</x>. The omit-when-false convention is preserved, so the golden XMLs change only in the body of already-present boolean elements. The RELAX NG schema is updated accordingly.Summary
Fixes a long-standing readability quirk in the XML output. The XML writer emitted true boolean members as
<x>1</x>(and omitted the element when false). Reading such output meant the consumer had to know in advance that the member was actually a boolean —1looks indistinguishable from an integer.The writer now emits the
xsd:booleanprimary lexical form:<x>true</x>. The omit-when-false convention is preserved, so the golden XML fixtures change only in the body of already-present boolean elements. The RELAX NG schema is updated to match.Changes
src/lib/Gen/xml/XMLWriter.cpp— the boolean-serialization branch now writes"true"instead of"1".test-files/golden-tests/updated to reflect the new<x>true</x>form. Intentional output corrections, not regenerations.mrdocs.rncupdated so the schema accepts the new lexical form on boolean elements."1"will need to update to handle"true". The omit-when-false convention is unchanged, so handling for absent elements is unaffected.Testing
"1"for booleans (or omits an element when true) fails the golden tests.test-files/golden-tests/on every build, so the new expectations stay enforced going forward.Documentation
The schema (
mrdocs.rnc) is the canonical reference for the XML output format and is updated. No prose documentation describes the previous"1"encoding, so nothing else needs updating.