Trouble Parsing XML File Using Perl

后端 未结 3 400
盖世英雄少女心
盖世英雄少女心 2021-01-24 21:13

I\'m trying to parse an XML manifest file for an Articulate eLearning course (imsmanifest.xml).

An excerpt of the XML structure is provided below (I\'m trying to drill d

3条回答
  •  执念已碎
    2021-01-24 21:59

    the xml is not valid, you need to close the tags metadata and resources

    after that XML::Simple will work with this code

    #!/usr/bin/env perl 
    
    use strict;
    use warnings;
    use XML::Simple;
    use Data::Dumper;
    
    
    use XML::Simple qw(:strict);
    
    my $ref = XMLin('test.xml',ForceArray => [], KeyAttr => {});
    print STDERR Dumper $ref;
    

提交回复
热议问题