mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 05:59:34 +02:00
Added support for null values: empty xml tag
This commit is contained in:
@@ -57,7 +57,12 @@ const convertObjectToXml = (
|
|||||||
: `${escapeXml(String(item))}`;
|
: `${escapeXml(String(item))}`;
|
||||||
xml += `</${keyString}>${newline}`;
|
xml += `</${keyString}>${newline}`;
|
||||||
});
|
});
|
||||||
} else if (typeof value === 'object' && value !== null) {
|
} else if (value === null) {
|
||||||
|
xml += `${getIndentation(
|
||||||
|
options,
|
||||||
|
depth
|
||||||
|
)}<${keyString}></${keyString}>${newline}`;
|
||||||
|
} else if (typeof value === 'object') {
|
||||||
xml += `${getIndentation(options, depth)}<${keyString}>${newline}`;
|
xml += `${getIndentation(options, depth)}<${keyString}>${newline}`;
|
||||||
xml += convertObjectToXml(value, options, depth + 1);
|
xml += convertObjectToXml(value, options, depth + 1);
|
||||||
xml += `${getIndentation(options, depth)}</${keyString}>${newline}`;
|
xml += `${getIndentation(options, depth)}</${keyString}>${newline}`;
|
||||||
|
Reference in New Issue
Block a user