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 78.66% 83.16% +4.49%
===========================================
Files 344 35 -309
Lines 35681 3658 -32023
Branches 7199 843 -6356
===========================================
- Hits 28067 3042 -25025
+ Misses 4984 409 -4575
+ Partials 2630 207 -2423
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 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-06-18 07:35:46 UTC |
530b6d2 to
bd82635
Compare
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. |
Yes. We used to have many. But I think it's going to be more like For |
|
Hi, checking in. We agreed on "empty element when true ( |
2b9534e to
40122e1
Compare
The XML writer rendered every true boolean as the literal `1`, for example `<is-inline>1</is-inline>`. That `1` carried no information beyond the element's own presence (a false boolean was already omitted entirely). So, encode a true boolean by presence alone: emit an empty element (`<is-inline/>`) and drop the redundant body. Absence still means false.
40122e1 to
721e020
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.Summary
This 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, as1looks 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
"true"instead of"1".<x>true</x>form."1"will need to update to handle"true". The omit-when-false convention is unchanged, so the handling of absent elements is unaffected.Testing
"1"for booleans (or omits an element when true) fails the golden tests.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.