|more useful options|
How to remove empty XML elements using XML::LibXMLby FreakyGreenLeaky (Sexton)
|on Feb 17, 2013 at 19:22 UTC||Need Help??|
FreakyGreenLeaky has asked for the
wisdom of the Perl Monks concerning the following question:
Evening robe-rufflers... I have next to zero experience with XML and XML::LibXML and I hope someone can shed some light on the following.
Basically, I want to remove some empty elements in XML.
I need to remove those last two empty elements, but I'm guessing the namespace stuff (or something) is a factor.
I've naively tried the following:
Edit: using the above findnodes() results in the error:
But I must admit I'm clueless here and would appreciate some pointers.
And I must confess to being mightily tempted to just remove add rem from the foreach. This works, but it makes me feel decidedly dirty - and I might need those elements in the future.
Not very elegant, but it works. If someone knows of a better way, I'd love to hear it.