-
Notifications
You must be signed in to change notification settings - Fork 730
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 text childs increase XML file size #570
Comments
Sure... why is this a problem? It's not clear to me if changing this is worth the benefit, as the application can just not create empty text children. |
I have text fields assigned by a template, without checking for empty/filled. Besides, why leave a mistake when you can do better? |
Ok, and it's impractical for your application to check if the field is empty before assigning? What if the field value is purely white space? Additionally, if your data has a lot of empty fields and the output size matters, do you need to add the nodes corresponding to empty fields at all? Overall I'm not entirely sure where the "mistake" is here. Maybe set() shouldn't even create a PCDATA node, or maybe the library works fine; it's an odd corner case. |
|
This behavior is confusing because:
I found out after comparing files with diff tool. So in case one wants to have expanded empty nodes then one should use existing format flag |
// (pseudo code)
xml::node Node = ParentNode.append_child("NewChildNode");
Node.text().set(""); // << create new text-type subchild with no text
// after save document to file we have:
<NewChildNode></NewChildNode>
// but must be (by default output format)
<NewChildNode />
// "virtual" empty text-child lock short form of record
The text was updated successfully, but these errors were encountered: