wankdanker / node-object-to-xml

Convert any JavaScript object to XML
MIT License
19 stars 8 forks source link

Empty value for an object prepares opening and empty tag for the xml instead of single closing tag #19

Closed padminikoppella closed 2 years ago

padminikoppella commented 2 years ago

I have a member object as below. When I have the age values as empty string, the result of the XML looks like instead of . How can I achieve this?

var o2x = require('object-to-xml'); Member Object: var member= { name: 'test', weight: '50', age: '' };

Result of o2x(member):

test 50
padminikoppella commented 2 years ago

I resolved it by setting the value as null. Thanks