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

allowEmpty fails #133

Closed
taschana opened this issue Aug 24, 2016 · 4 comments
Closed

allowEmpty fails #133

taschana opened this issue Aug 24, 2016 · 4 comments

Comments

@taschana
Copy link

I've got a complex routine to build xml (even generating some namespace for myself), all is well, except for the allowEmpty part.
Generating the string like this:
xmlObject.end({ pretty: true, newLine: "\n", allowEmpty: true })
produces an output like that:
<sch:comsumptionTier xsi:nil="true"/>

I am not sure if an object is not considered "empty" anymore, when it contains an attribute, but this shouldn't prevent the algorithm from producing a closing tag.

Please help me find and (hot)fix this.
Thanks a lot for the otherwise great plugin and I am looking forward to new features!

Natascha

PS: if you want more code to debug this, just say so.

@oozcitak
Copy link
Owner

oozcitak commented Oct 8, 2016

Please see: https://github.com/oozcitak/xmlbuilder-js/wiki#converting-to-string. You need to set allowEmpty: false if you want closing tags always.

@hatton
Copy link

hatton commented Dec 27, 2018

I don't understand. Taschana seemed to be asking for NON-self-closing tags. @oozcitak your answer seems to just tell her how to get self-closing tags.

I'm pointing this out because I, too, am setting allowEmpty: true and yet I, too, am getting <mytag/>.

@oozcitak
Copy link
Owner

Can you submit a test case please?

@hatton
Copy link

hatton commented Dec 27, 2018

I cannot, because I'm an idiot and the problem was a case that wasn't going through xmlbuilder at all. Sorry!

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

3 participants