in reply to finding XPATH for any node in a XML file

See Extracting Xpths from XML schema
  • Comment on Re: finding XPATH for any node in a XML file

Replies are listed 'Best First'.
Re^2: finding XPATH for any node in a XML file
by Anonymous Monk on Apr 20, 2012 at 15:26 UTC

    1.

    use XML::Twig ; XML::Twig->new( twig_handlers => { '*' => sub { print $_->xpath, "\n"; }, }, )->xparse( "somefile.xml" );

    2.

    use XML::Twig ; XML::Twig->new( start_tag_handlers => { '_all_' => sub { print $_->xpath, "\n"; }, }, )->xparse( "somefile.xml" );