Skip to content

Commit

Permalink
Pass stringify option through to xmlbuilder-js
Browse files Browse the repository at this point in the history
  • Loading branch information
boxfoot committed Apr 27, 2018
1 parent e8540dc commit c6c1530
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,17 @@ Possible options are:
* `xmldec.standalone` standalone document declaration: true or false
* `doctype` (default `null`): optional DTD. Eg. `{'ext': 'hello.dtd'}`
* `headless` (default: `false`): omit the XML header. Added in 0.4.3.
* `stringify` (default: `null`): a set of functions to use for converting values to strings
(see `xmlbuilder-js`'s
[XMLStringifier](https://github.com/oozcitak/xmlbuilder-js/blob/master/src/XMLStringifier.coffee)
class for more information)
* `allowSurrogateChars` (default: `false`): allows using characters from the Unicode
surrogate blocks.
* `cdata` (default: `false`): wrap text nodes in `<![CDATA[ ... ]]>` instead of
escaping when necessary. Does not add `<![CDATA[ ... ]]>` if it is not required.
Added in 0.4.5.
`renderOpts`, `xmldec`,`doctype` and `headless` pass through to
`renderOpts`, `xmldec`,`doctype`, `stringify`, and `headless` pass through to
[xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js).
Updating to new version
Expand Down
1 change: 1 addition & 0 deletions lib/builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/defaults.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/builder.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class exports.Builder

rootElement = builder.create(rootName, @options.xmldec, @options.doctype,
headless: @options.headless
stringify: @options.stringify
allowSurrogateChars: @options.allowSurrogateChars)

render(rootElement, rootObj).end(@options.renderOpts)
1 change: 1 addition & 0 deletions src/defaults.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ exports.defaults = {
xmldec: {'version': '1.0', 'encoding': 'UTF-8', 'standalone': true}
doctype: null
renderOpts: { 'pretty': true, 'indent': ' ', 'newline': '\n' }
stringify: null
headless: false
chunkSize: 10000
emptyTag: ''
Expand Down

0 comments on commit c6c1530

Please sign in to comment.