Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty strings are coming as self closing xml element #38

Open
halilgithub opened this issue Nov 27, 2021 · 0 comments
Open

empty strings are coming as self closing xml element #38

halilgithub opened this issue Nov 27, 2021 · 0 comments

Comments

@halilgithub
Copy link

halilgithub commented Nov 27, 2021

Hello,

at first thank you for that great library, I have a question: I am converting a small json object to xml but keys with empty strings values ("Value": "") in json are coming as self closing xml element (<Value />) But I want it to be a normal opening and closing xml element (<Value></Value>). What am I doing wrong ?

Code:

var myjson = { "Test_details": {
"Test_No.": {
"Value": "",
"Remark": "to be filled by me",
"Example": 1234
}}};

console.log(jsontoxml(myjson, xmlHeader=true, escape=true, removeIllegalNameCharacters=true));

Output:

<?xml version="1.0" encoding="utf-8"?>
<Test_details>
<Test_No.>
<Value />
<Remark>to be filled by me</Remark>
<Example>1234</Example>
</Test_No.>
</Test_details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant