fast-xml-parser icon indicating copy to clipboard operation
fast-xml-parser copied to clipboard

unable to use the value "true" in an attribute

Open angrymarker opened this issue 2 years ago • 2 comments

Checklist

  • [ ] Have you asked your question on Stackoverflow or similar forum?
  • [X ] Are you running the latest version?
  • [ X] Have you included sample input, output, error, and expected output?
  • [X ] Have you checked if you are using correct configuration?
  • [ X] Did you try online tool?

Input object:

{
    "iteration": {
        "@_test": "true",
    }
}

Code

``

const { XMLBuilder } = require('fast-xml-parser');
builder = new XMLBuilder({ ignoreAttributes: false, format: true, suppressEmptyNode: true });
builder.build({
    "iteration": {
        "@_test": "true",
    }
})

### Output

<?xml version="1.0"?>
<iteration test></iteration>


### expected data

<?xml version="1.0"?>
<iteration test="true"></iteration>



**Would you like to work on this issue?**
<!-- choose one by changing [ ] to [x] -->
- [ ] Yes
- [ X] No

[Bookmark](https://github.com/NaturalIntelligence/fast-xml-parser/stargazers) this repository for further updates.

angrymarker avatar Sep 28 '22 19:09 angrymarker

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.

github-actions[bot] avatar Sep 28 '22 19:09 github-actions[bot]

this is good html, but not good xml. throwing into an xml linter or internet explorer bombs out, expecting the attribute to equal something

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


A name contained an invalid character. Error processing resource 'file://x

  <Package isAddtPkg>
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the [Refresh](javascript:location.reload()) button, or try again later.

A name contained an invalid character. Error processing resource 'file:/X

angrymarker avatar Sep 28 '22 19:09 angrymarker

Have you tried 'suppressBooleanAttributes:false' ?

amitguptagwl avatar Oct 05 '22 11:10 amitguptagwl

closing as no response. Please reopen if issue still exist

amitguptagwl avatar Jan 07 '23 08:01 amitguptagwl