in reply to XML::Twig and the monasteries XML

XML::Twig ISA XML::Parser so it doesn't touch the content by default, but you can add a input filter.


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^2: XML::Twig and the monasteries XML (updated)
by LanX (Saint) on May 30, 2019 at 23:31 UTC
    Thanks, defining an input_filter did the trick °

    $twig=XML::Twig->new( #discard_spaces => 1, input_filter => sub { $_[0] =~ s/^\n//r }, );

    Also found discard_spaces but couldn't make it work though.

    updated

    or rather not !

    I checked all calls to the callback, and the input filter is run on each line of input.

    I.e. it will also discard newlines in the middle of a content.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice