This repository was archived by the owner on Jan 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- var xml = '' ;
2- module . exports = function toXml ( json ) {
1+ module . exports = function toXml ( json , xml ) {
2+ var xml = xml || '' ;
33 if ( json instanceof Buffer ) {
44 json = json . toString ( ) ;
55 }
@@ -26,12 +26,12 @@ module.exports = function toXml(json) {
2626 var l = elems . length ;
2727 for ( var j = 0 ; j < l ; j ++ ) {
2828 xml += '<' + key + '>' ;
29- toXml ( elems [ j ] ) ;
29+ xml = toXml ( elems [ j ] , xml ) ;
3030 xml += '</' + key + '>' ;
3131 }
3232 } else if ( typeof ( obj [ key ] ) == 'object' ) {
3333 xml += '<' + key + '>' ;
34- toXml ( obj [ key ] ) ;
34+ xml = toXml ( obj [ key ] , xml ) ;
3535 xml += '</' + key + '>' ;
3636 } else if ( typeof ( obj [ key ] ) == 'string' ) {
3737 if ( key == '$t' ) {
Original file line number Diff line number Diff line change 55 "description" : " Converts xml to json using node-expat." ,
66 "repository" : " git://github.com/buglabs/node-xml2json.git" ,
77 "main" : " index" ,
8- "maintainers" :[ {
9- "name" : " Camilo Aguilar" ,
10- "email" : " camilo@buglabs.net" }
11- ],
8+ "contributors" :[ {"name" : " Camilo Aguilar" , "email" : " camilo@buglabs.net" }],
129 "dependencies" : {
1310 "node-expat" : " 1.3.2"
1411 }
You can’t perform that action at this time.
0 commit comments