Skip to content

Commit 96fbf31

Browse files
committed
Merge pull request #3 from cotycondry/master
Fix for undefined @attributes, update the deprecated nodeValue
2 parents 876ecf4 + ea51133 commit 96fbf31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

js/xml2json.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
// Add attributes if any
3636
if(node.attributes.length > 0) {
3737
result[node.nodeName]['@attributes'] = {};
38+
child['@attributes'] = {};
3839
for(var j in node.attributes) {
3940
var attribute = node.attributes.item(j);
40-
child['@attributes'][attribute.nodeName] = attribute.nodeValue;
41+
child['@attributes'][attribute.nodeName] = attribute.value;
4142
}
4243
}
4344

0 commit comments

Comments
 (0)