我需要构建一个相对简单的XML文档,其中包含一些层次结构和JS对象的一些属性.在选择其中一个模块之前,我现在站了起来:
https://github.com/davidcalhoun/jstoxml
https://github.com/soldair/node-jsontoxml
https://github.com/QuickenLoans/node-easyxml
https://github.com/michaelkourlas/node-js2xmlparser
我应该选择哪个模块?
这个问题可能会被认为不是一个好问题,但我不知道如何以不同的方式提出这个问题.
免责声明:我在每个存储库上发布了相同的问题作为问题
这是我想要构建的XML:
123123 345345 7604 qwert 0 GB 02 0 qwerty Q.W.E Qwerty Some company Postbus 13 1234 AB THERE NL a@b.nl 0168-123456 06-12345678 1234 8765432 164-05-366 2 Some gift voucher 1233 5678 8765432 164-05-367 3 Some other gift voucher 1244
Christiaan W.. 37
我调查了自己
| author | davidcalhoun | soldair | QuickenLoans | michaelkourlas | |---------------|--------------|-----------|--------------|----------------| | module | jstoxml | node- | node- | node- | | | | jsontoxml | easyxml | js2xmlparser | | Commits | 31 | 64 | 39 | 61 | | Recent commit | a year ago | 2 years ag| 6 months ago | 16 days ago | | Contributors | 2 | 7 | 7 | 6 | | Issues | 16 | 19 | 17 | 15 | | Open Issues | 7 | 1 | 6 | 1 | | npm install | jstoxml | not found | easyxml | js2xmlparser | | Dependencies | None | None | elementtree, | None | | | | | inflect | | | Throws errors | None | None | 3 | 12 |
然后是比较所需的对象类型
davidcalhoun/jstoxml:
{ "_name": 'foo', "_content": 'bar', "_attrs": { "a": 'b', "c": 'd' } }
soldair/node-jsontoxml:看起来很复杂
QuickenLoans/easyxml:
items: [{ "name": 'one', "_id": 1 }, { "name": 'two', "_id": 2 } ]
michaelkourlas /节点js2xmlparser
foo: { "#": 'bar', "@": { a: 'b', c: 'd' } }
我想我会给michaelkourlas的node-js2xmlparser一个镜头.
更新:现在看来还有2个值得一提:
chilts/data2xml
oozcitak/xmlbuilder-JS
后者是迄今为止最成熟的并且在npm下载.它允许您一次性或迭代地构建XML.
我调查了自己
| author | davidcalhoun | soldair | QuickenLoans | michaelkourlas | |---------------|--------------|-----------|--------------|----------------| | module | jstoxml | node- | node- | node- | | | | jsontoxml | easyxml | js2xmlparser | | Commits | 31 | 64 | 39 | 61 | | Recent commit | a year ago | 2 years ag| 6 months ago | 16 days ago | | Contributors | 2 | 7 | 7 | 6 | | Issues | 16 | 19 | 17 | 15 | | Open Issues | 7 | 1 | 6 | 1 | | npm install | jstoxml | not found | easyxml | js2xmlparser | | Dependencies | None | None | elementtree, | None | | | | | inflect | | | Throws errors | None | None | 3 | 12 |
然后是比较所需的对象类型
davidcalhoun/jstoxml:
{ "_name": 'foo', "_content": 'bar', "_attrs": { "a": 'b', "c": 'd' } }
soldair/node-jsontoxml:看起来很复杂
QuickenLoans/easyxml:
items: [{ "name": 'one', "_id": 1 }, { "name": 'two', "_id": 2 } ]
michaelkourlas /节点js2xmlparser
foo: { "#": 'bar', "@": { a: 'b', c: 'd' } }
我想我会给michaelkourlas的node-js2xmlparser一个镜头.
更新:现在看来还有2个值得一提:
chilts/data2xml
oozcitak/xmlbuilder-JS
后者是迄今为止最成熟的并且在npm下载.它允许您一次性或迭代地构建XML.