in reply to searching a empty XML tag or self enclosing tags

I usually use XML::XSH2 for XML manipulation. To search for nodes, it uses XPath. In this case, you can use:
ls //*[0=count(./* | ./@* | ./text() | ./comment() | ./processing-inst +ruction())]
(You did not specify what to do with comments and processing instructions. You might need to change the XPath accordingly.)

Replies are listed 'Best First'.
Re^2: searching a empty XML tag or self enclosing tags
by Anonymous Monk on Apr 19, 2012 at 14:24 UTC

    I wouldn't wish xsh on my worst enemies

      Can you elaborate? What is your favourite tool?

      Regarding the OP and my reply, the XPath expression can be used in any other tool supporting XPath.

        twig , twig, twig, libxml

        xsh is impossible to learn :) xml is complicated enough, xpath is complicated enough, add in some mystery pita shell with no diagnostics/splain/highlighting, and you can't get anything done :)( I gave it a go a few times, its just too painful)

        Ignoring Petr Pajas , I've only seen choroba and merlyn, use xsh.