Closed ATXadam closed 9 months ago
We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.
After starting to look through the code, I saw suppressBooleanAttributes in the XMLBuilder options, setting this to false resolves the issue. https://naturalintelligence.github.io/fast-xml-parser/ "Allow Boolean Attributes" did not set this flag going from JSON to XML it appears.
const { XMLBuilder } = require('fast-xml-parser');
let builder = new XMLBuilder({ ignoreAttributes: false, suppressBooleanAttributes: false});
builder.build({"test": {"@_isTrue": true}});
Yields
<test isTrue="true"></test>
Description
When using XMLBuilder to render an attribute with a value (string or bool) of 'true', XMLBuilder does not render the value as a string in the attribute.
Input
Code
Output
expected data
Would you like to work on this issue?
Bookmark this repository for further updates. Visit SoloThought to know about recent features.