Skip to content

Commit

Permalink
Add documents for suppressBooleanAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
amitguptagwl committed Dec 5, 2021
1 parent e17c526 commit 0ea2ca0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions docs/v4/3.XMLBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,39 @@ As you set `stopNodes` to the XML parser configuration to avoid parsing and proc

This property is currently supported with `preserveOrder: true` option only.

## suppressBooleanAttributes
You can parse attributes with value `true` without their value.

Input
```js
const jsOrderedObj = [
{
"?textinfo": [
{
"#text": ""
}
],
":@": {
"@_whitespace": true,
"@_is": true,
"@_allowed": true
}
}
];
const options = {
ignoreAttributes: false,
preserveOrder: true,
allowBooleanAttributes: true,
suppressBooleanAttributes: true
};
const builder = new XMLBuilder(options);
const output = builder.build(result);
```
Outout
```xml
<?textinfo whitespace is allowed?>
```

## suppressEmptyNode
Tags with no text value would be parsed as empty tags.
Input
Expand Down
3 changes: 2 additions & 1 deletion docs/v4/7.PITags.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ When you setup builder to parse the above JS ordered object
const options = {
ignoreAttributes: false,
preserveOrder: true,
allowBooleanAttributes: true
allowBooleanAttributes: true,
suppressBooleanAttributes: true
};
const builder = new XMLBuilder(options);
const output = builder.build(result);
Expand Down

0 comments on commit 0ea2ca0

Please sign in to comment.