-
-
Notifications
You must be signed in to change notification settings - Fork 329
Open
Description
- [ X] Are you running the latest version?
- Have you included sample input, output, error, and expected output?
- Have you checked if you are using correct configuration?
- [ X] Did you try online tool?
- [ X] Have you checked the docs for helpful APIs and examples?
Description
I found out from ChatGPT that the option attributesGroupName
controls whether the simple properties in json are converted to tag attributes or to xml sub-tags. But the description of this option is not understandable and, imho, misleading. There are no examples for this option either.
Input
{
e: {
a: {
f: "bc"
}
}
}
Code
p = require("../fxp.cjs");
xmlBuilder = new p.XMLBuilder({
attributesGroupName: **false**, //THE ISSUE IS ABOUT THIS OPTION
ignoreAttributes: false,
attributeNamePrefix: "",
format: true,
});
console.log(xmlBuilder.build({e:{a: {f: "bc"}}}))
xmlBuilder = new p.XMLBuilder({
attributesGroupName: **true**, //THE ISSUE IS ABOUT THIS OPTION
ignoreAttributes: false,
attributeNamePrefix: "",
format: true,
});
console.log(xmlBuilder.build({e:{a: {f: "bc"}}}))
Output
<e>
<a f="bc"></a>
</e>
<e>
<a>
<f>bc</f>
</a>
</e>
expected data
The output is correct. However, the description of the option attributesGroupName must be much more preciser.
Would you like to work on this issue?
- [ X] Yes
- No
Bookmark this repository for further updates. Visit SoloThought to know about recent features.
Metadata
Metadata
Assignees
Labels
No labels