in reply to Re^3: Parsing XML
in thread Parsing XML

The documentation isn't very friendly, I trying this way, but I am getting a lot of XML instead of just the "999":
... my $t= XML::Twig->new( twig_handlers => { 'CustDetails' => sub { $_->first_child('C +ustomerId')->text(), } } ) ->parse($test_xml); warn Dumper $t;

Replies are listed 'Best First'.
Re^5: Parsing XML
by Corion (Patriarch) on Sep 02, 2016 at 16:37 UTC

    Have you tried searching for the "text" or "content" method? Maybe it does what you need?

    You don't show what output you actually get, and I'm really bad at guessing.

    Maybe you can show what output you get for which input.

    Personally, I found it always quite enlightening to also look at the value of ->path to see which node is output, and also maybe find out why.