xml-mapping
Advanced tools
Comparing version
@@ -209,3 +209,5 @@ 'use strict'; | ||
parser.oncomment = function (v) { | ||
cvalue('$c', v); | ||
if (options.comments === undefined || options.comments !== false) { | ||
cvalue('$c', v); | ||
} | ||
}; | ||
@@ -212,0 +214,0 @@ parser.oncdata = function (v) { |
{ | ||
"name": "xml-mapping", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -62,2 +62,3 @@ # xml2json and json2xml for NodeJS | ||
* `nested` - *boolean* - Flag to ignore nested tags inside text : *default : false* | ||
* `comments` - *boolean* - Flag to ignore comments, if false all the comments will be ignored : *default : true* | ||
@@ -64,0 +65,0 @@ ```javascript |
@@ -174,2 +174,15 @@ var XMLMapping = require('../'); | ||
}; | ||
exports['t08a'] = function (test) { | ||
input = '<!-- comment --><key1><key2 attr="value1"/><key3 attr="value2"/></key1>'; | ||
test.deepEqual(XMLMapping.load(input), { '$c': 'comment', key1 : { key2 : { attr : 'value1'}, key3 : { attr : 'value2'} } }); | ||
test.done(); | ||
}; | ||
exports['t08b'] = function (test) { | ||
input = '<!-- comment --><key1><key2 attr="value1"/><key3 attr="value2"/></key1>'; | ||
test.deepEqual(XMLMapping.load(input, {comments: false}), { key1 : { key2 : { attr : 'value1'}, key3 : { attr : 'value2'} } }); | ||
test.done(); | ||
}; | ||
/* */ |
44495
2.73%20
5.26%880
2.44%108
0.93%