You can use perl's XML::Simple module, it's easy to use too

#!/usr/bin/perl use strict; use warnings; use XML::Simple; use Data::Dumper; my $xml = new XML::Simple; my $data = $xml->XMLin("test.xml"); print Dumper $data; print "$data->{'group'}{'gotoButton'}{'name'} - "; print "$data->{'group'}{'gotoButton'}{'display'}\n"; print "$data->{'gotoButton'}{'name'} - "; print "$data->{'gotoButton'}{'display'}\n"; Output: $VAR1 = { 'gotoButton' => { 'imageSettings' => { 'imageName' => '', 'alignment' => 'middleCen +ter' }, 'caption' => { 'fontFamily' => 'Arial', 'caption' => 'TO CRXW616 AIR/OIL', 'fontSize' => '9' }, 'name' => 'GotoDisplayButton12', 'display' => '36 AIR_OIL SYSTEM SETUP_2' }, 'group' => { 'gotoButton' => { 'imageSettings' => { 'imageName' => + '', 'alignment' => + 'middleCenter' }, 'caption' => { 'fontFamily' => 'Ari +al', 'caption' => 'MAIN M +ENU', 'fontSize' => '9' }, 'name' => 'GotoDisplayButton3', 'display' => '19 UNIT STATUS' }, 'visible' => 'true', 'wallpaper' => 'false', 'name' => 'Group1', 'isReferenceObject' => 'false' } }; GotoDisplayButton3 - 19 UNIT STATUS GotoDisplayButton12 - 36 AIR_OIL SYSTEM SETUP_2

Using dumper, you will get the data inside the xml file in perl datastructure i.e, hash of hashes or arrays from which data can be pulled out in similar manner as I have mentioned in code.


In reply to Re: Perl LibXML Help. by simmisam
in thread Perl LibXML Help. by DunLidjun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.