Skip to content

Commit 4dcea81

Browse files
committed
Added note about leading/trailing text/whitespace (closes #1)
1 parent 4bca5a6 commit 4dcea81

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ var parse = require('jsonml-parse');
4141

4242
### parse(markup, callback)
4343

44-
Parses the `markup` string and invokes `callback` when done. `callback` is treated as a node-style callback, i.e. the first argument will always be the error object (`null` on success), and the second will always be the JSONML result. *Note:* If `markup` contains multiple top-level nodes they will be wrapped in an array before being passed to `callback`.
44+
Parses the `markup` string and invokes `callback` when done. `callback` is treated as a node-style callback, i.e. the first argument will always be the error object (`null` on success), and the second will always be the JSONML result. *Note:* If `markup` contains multiple top-level nodes they will be wrapped in an array before being passed to `callback`. This will also be the case if your markup has leading and/or trailing whitespace/text. For consistent resuls be sure to `String#trim()` the markup before passing it to `parse()`.
4545

4646
### var stream = parse()
4747

48-
Returns a new [transform stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) which you will write the markup to, and read the JSONML from. *Note:* Each top-level node will be emitted as separate 'data' events.
48+
Returns a new [transform stream](http://nodejs.org/api/stream.html#stream_class_stream_transform) which you will write the markup to, and read the JSONML from. *Note:* Each top-level node will be emitted as separate 'data' events. Any whitespace/text before, after, or in between top-level nodes will be treated as a separate top-level nodes, so be sure to handle accordingly in your `data` event handlers.
4949

5050
## CLI
5151

@@ -67,4 +67,4 @@ Example:
6767
6868
```bash
6969
curl www.bbc.co.uk | jsonmlparse > bbc.json
70-
```
70+
```

0 commit comments

Comments
 (0)