in reply to How can I browse & list XPATH of a XML Message?

Pretty easy in XML::XSH2, a wrapper around XML::LibXML:
open file.xml ; for ( /descendant-or-self::node() | //@* ) echo xsh:path(.) (.) ;

To skip double reports for text() nodes and non-leaf nodes, you can add

[not(./*)][not(self::text())]

after the node().

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: How can I browse & list XPATH of a XML Message?
by Anonymous Monk on Oct 30, 2015 at 06:32 UTC

     [not(./*)][not(self::text())]

    thats xsh syntax? what is equivalent xpath syntax?

      No, that's standard XPath syntax. What made you think it's not?
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        the stacking  [][] and maybe (if thats what you meant) starting with  []
        can you explain it in plain English?