Skip to content

Commit

Permalink
xmlwriter indent option and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenvachon committed Feb 22, 2014
1 parent ea7ea00 commit e5bcd38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -58,6 +58,13 @@ xamel.parse(xmlSource, { buildPath : 'root/body/article' }, function(err, xml) {

You can also check the [partial parsing test](https://github.com/nodules/xamel/blob/master/test/parse.js#L25).

## xamel.serialize(nodeset, [options])

* `nodeset` NodeSet to serialize;
* `options` parsing options:
* `header` – when evaluated to `false` the document will not contain a `<?xml?>` header, `true` by default;
* `pretty` – when evaluated to `true` the document will be beautified with indents and line breaks, `false` by default;

## NodeSets and map/reduce

Result of `xamel.parse(…)` is a NodeSet. You can think of NodeSet as an array of nodes (internally it's true).
Expand Down
2 changes: 1 addition & 1 deletion lib/serialize.js
Expand Up @@ -65,7 +65,7 @@ function serialize(nset, options) {
options = {};
}

var xw = new XMLWriter();
var xw = new XMLWriter(options.pretty);

if (options.header !== false) {
xw.startDocument();
Expand Down

0 comments on commit e5bcd38

Please sign in to comment.