fast-xml-parser
fast-xml-parser copied to clipboard
Option to remove empty tags completly
Is it possible to create an Builder option in order to remove empty tags ?
"suppressEmptyNode" option builds empty tags to self closing tags, but it would be nice to remove it completely on the output.
Thanks !
I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.
We're planning to introduce skipNodes
in future version. It might help you.
Thanks for you quick reply. Do you have a release date ?
Thanks again
The decision is still not taken. Check this discussion: https://github.com/NaturalIntelligence/fast-xml-parser/discussions/445
We're planning to introduce
skipNodes
in future version. It might help you.
Reading the discussion on skipNodes, it seems that it is intended to be used in XML Parser and you need to specify which node to skip. While options in general seems to work on both Parser and Builder, I don't think that it will help in the original case since they might not know beforehand which node is empty and therefore need to be skipped.
@tinusriyanto builder is not updated as I started working on v5 of this library where I provided better way to handle it. But i couldn't publish the v5 yet due to some performance issue and my busyness.
But to answer your question, from the updateTag
method, user will be able to check the value, argument list and other necessary meta data that can help user to decide when to skip a tag in parser or builder.