juo has asked for the wisdom of the Perl Monks concerning the following question:

Does somebody has a subroutine that easily converts an XML page into a hash table.

  • Comment on converting a xml page into a hash table

Replies are listed 'Best First'.
Re: converting a xml page into a hash table
by blakem (Monsignor) on Sep 11, 2001 at 11:01 UTC
    There are *lots* of XML modules available... if you're new to XML and your data is simple enough, I'd recommend XML::Simple, or try doing a Super Search on XML.

    -Blake

      I normally use XML::Simple to convert an XML file to a hash array. The following code will store the contents of in.xml in a hash array.

      #-- Sample code use strict; use XML::Simple; my $mXML; $mXML = XMLin('./in.xml',forcearray => 1);

      You might also want to use the Data::Dumper module to view the hash array.

      I hope this helps.

Re: converting a xml page into a hash table
by Zaxo (Archbishop) on Sep 11, 2001 at 10:59 UTC
    XML

    After Compline,
    Zaxo