I'm struggling with problem, what probably has simple code solution, but was not able to find it for Javascript.
I want to clean XML from empty elements using DOMParser or whatever JS tools.
Example input:
<xml>
<test>1</test>
<test2></test2>
<test3></test3>
<test4>
<blah>1</blah>
<bruh></bruh>
</test4>
</xml>
Output:
<xml>
<test>1</test>
<test4>
<blah>1</blah>
</test4>
</xml>
Edit: First suggestion from #4800808 were OK for that example, but it does not work, when XML has attributes. What about this:
<xml>
<test>1</test>
<test2></test2>
<test3></test3>
<test4 attr="value">
<blah>1</blah>
<bruh></bruh>
</test4>
</xml>