Say I have this XML and I need to remove empty elements (elements that doesn't contain data at all) such as
... <date> <!-- keep oneDay --> <oneDay> <startDate>1450288800000</startDate> <endDate>1449086400000</endDate> </oneDay> <!-- remove range entirely --> <range> <startDate/> <endDate/> </range> <!-- remove deadline entirely --> <deadline> <date/> </deadline> <data> ...
The output then should be
<oneDay> // keep this <startDate>1450288800000</startDate> <endDate>1449086400000</endDate> </oneDay>
I'm looking for a dynamic solution that would work on any cases like this regardless of the literal name of the element.
No comments:
Post a Comment