Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    my $root = XML::LibXML->new->parse_string($xml)->documentElement;
    my %data = map { $_->nodeName => $_->textContent }
       $root->findnodes('/*/*');
    
  2. or download this
    use strict;
    use warnings;
    ...
    $XML::Simple::PREFERRED_PARSER = 'XML::Parser';  # Fastest backend
    my $parser = XML::Simple->new( ForceArray => [], KeyAttr => {} );
    my $data = $parser->XMLin($xml);