Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass stringify option through to xmlbuilder-js #451

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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