You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 7, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Simple SAX-based XML2JSON Parser.
2
2
3
-
It does not parse the following elements:
3
+
It does not parse the following elements:
4
4
5
5
* CDATA sections (*)
6
6
* Processing instructions
@@ -13,7 +13,7 @@ It does not parse the following elements:
13
13
$ npm install xml2json
14
14
```
15
15
16
-
## Usage
16
+
## Usage
17
17
```javascript
18
18
var parser =require('xml2json');
19
19
@@ -39,18 +39,20 @@ var options = {
39
39
reversible:false,
40
40
coerce:true,
41
41
sanitize:true,
42
-
trim:true
42
+
trim:true,
43
+
arrayNotation:false
43
44
};
44
45
```
45
46
46
47
***object:** Returns a Javascript object instead of a JSON string
47
48
***reversible:** Makes the JSON reversible to XML (*)
48
49
***coerce:** Makes type coercion. i.e.: numbers and booleans present in attributes and element values are converted from string to its correspondent data types.
49
50
***trim:** Removes leading and trailing whitespaces as well as line terminators in element values.
51
+
***arrayNotation:** XML child nodes are always treated as arrays
50
52
***sanitize:** Sanitizes the following characters present in element values:
51
53
52
54
```javascript
53
-
var chars = {
55
+
var chars = {
54
56
'<':'<',
55
57
'>':'>',
56
58
'(':'(',
@@ -88,4 +90,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
88
90
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
89
91
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
90
92
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
0 commit comments