Hi,
I am trying to learn and use XML with perl but because of difficulty that I am having with the perldoc XML::Twig and also the website of twig(despite
all the tutorials, I decide to seek for help here.
honestly, I just don't think I am getting it.
Anyway, I have fairly complicated XML file I want to parse out so that I can do some report on it but I am just not sure how to use XML::Twig nor
if XML::Twig is even the right module to use.
I have been
1)trying to read the doc but honestly, it's little bit over my head...
2)trying to follow the tutorials on the website but it's not giving me what I want..(i am sure I am just not getting it .. same for 1) as well but
3)also did super seach on perlmonks w/ following key words ---> xml twig and read pretty much read all posts)
I have wrote a example xml file below and my question is,
if I wanted to make a array of id so that my @array will contain qw/ msn movies espn/ how would I go about doing it?
I was thinking somehow using first_child method?
Would appreciate the pointer/advise.
thank you
-------- code that I was just looking at-------------
#!/usr/bin/perl
use warnings;
use strict;
use XML::Twig;
my $twig = XML::Twig->new(twig_roots => { one => 1});
$twig->parsefile(shift);
$twig->print;
--- example file -------
<config>
<one id="msn" type="shopping">
<traffic>
<daily value="on" />
<weekly value="off" />
<monthly value="off" />
</traffic>
</one>
<one id="movies" type="entertainment">
<traffic>
<daily value="on" />
<weekly value="off />
<monthly value="on" />
</traffic>
</one>
<one id="espn" type="sports">
<traffic>
<daily value="on" />
<weekly value="on" />
<monthly value="on />
<hyper value="true />
</traffic>
</one>
</config>