Closed croghostrider closed 1 year ago
I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.
Seems like docs need to be updated. For the time, this is the solution.
fixed
hi @amitguptagwl unfortunately the parameter "suppressUnpairedNode" does not help.
const xmlData = `
<rootNode>
<tag>value</tag>
<empty />
<unpaired>
<unpaired />
<unpaired></unpaired>
</rootNode>`
const options = {
format: true,
suppressUnpairedNode: false,
unpairedTags: ['unpaired']
}
const parser = new fxparser.XMLParser(options)
const result = parser.parse(xmlData)
const builder = new fxparser.XMLBuilder(options)
const output = builder.build(result)
<rootNode>
<tag>value</tag>
<empty></empty>
<unpaired></unpaired>
<unpaired></unpaired>
<unpaired></unpaired>
</rootNode>
<rootNode>
<tag>value</tag>
<empty></empty>
<unpaired/>
<unpaired/>
<unpaired/>
</rootNode>
what version are you using?
4.0.13
This is working completely fine to me
const xmlData = `
<rootNode>
<tag>value</tag>
<empty />
<unpaired>
<unpaired />
<unpaired></unpaired>
</rootNode>`
const options = {
format: true,
suppressUnpairedNode: false,
unpairedTags: ['unpaired']
}
const parser = new XMLParser(options)
const result = parser.parse(xmlData)
const builder = new XMLBuilder(options)
const output = builder.build(result)
console.log(output);
Output
<rootNode>
<tag>value</tag>
<empty></empty>
<unpaired/>
<unpaired/>
<unpaired/>
</rootNode>
Strange, here on Codepen you can see it doesn't work.
I have noticed that CDN sometime hold old library. So I'm not sure if that is correct.
Hi @amitguptagwl
The file from the CDN is identical to the file from Github, but I noticed that the last change was more than 1 year ago.
I found the mistake I will open a new issue.
Description
Hi if I try the Unpaired Tags example with version 4.0.13 I don't receive the same output as in the example.
Code
Output
expected data
Would you like to work on this issue?