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

Feature Request: SuppressEmpty => undef support #17

Closed
slobo opened this issue Dec 26, 2019 · 2 comments
Closed

Feature Request: SuppressEmpty => undef support #17

slobo opened this issue Dec 26, 2019 · 2 comments

Comments

@slobo
Copy link

slobo commented Dec 26, 2019

Hi,
Thanks for the great work, we love XML::Hash::XS and rely on it in production. We've found another opportunity to benefit form the blazing speed of it - by having Paws (Perl AWS SDK) switch to XML::Hash::XS from XML::Simple.

Work on this has begun, see pplu/aws-sdk-perl#66 and pplu/aws-sdk-perl#366. One incompatibility we hit is the configurable SuppressEmpty behaviour of XML::Simple. Currently, XML::Hash::XS behaves equivalent to specifying SuppressEmpty => '' -- it produces empty strings when empty nodes (no content and no attribute) is found. For Paws purposes, it would be great to have ability to emit undef instead, so we don't have to do an additional pass over the resulting hash to remove those, which would negate some of the speed benefits of using X:H:XS.

Is this something that you think is appropriate to be added to XML::Hash::XS? Paws don't need the other behaviours of SuppressEmpty (XML::Simple defaults to emitting an empty hash, 1 for skipping empty nodes altogether), but it could perhaps help others migrate if those would be easy to add too.

Thanks!

@yoreek
Copy link
Owner

yoreek commented Dec 28, 2019

Thank you for your interest with this module.
I added the “suppress_empty” option with the same behavior as in XML::Simple, although almost everything is already confused in this module, and need to refactor it.
Please test the module so that everything works as it should.

@slobo
Copy link
Author

slobo commented Dec 28, 2019

Thank you for such quick response. suppress_empty => undef seems to work exactly as we need it!

@yoreek yoreek closed this as completed Feb 18, 2020
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

2 participants