Scott Taylor wrote:
> Hello,
> 
> I have an XML file that I need to import to a database, however, searching
> CPAN for XML brings up a lot of stuff.  I don't know what I need to know.
> :(
> 
> What module should I use for something simple like the following data?
> 
> Can someone provide an example, or direct me to some good docs with
> working examples.  I tried XML::Parser but even the example didn't work,
> and the little docs it has makes no sense to me.
>

I would start with XML::Simple until you need more.

use XML::Simple;

my $xs = new XML::Simple;
my $ref = $xs->XMLin('test.xml');

use Data::Dumper;
print Dumper($ref);

http://danconia.org


> If I could get the data into some form of variables, I can do the DB parts.
> 
> Cheers.
> 
> <device>
>         <drv></drv>
>         <event>I</event>
>         <vid>29751</vid>
>         <eid>0</eid>
>         <jibrish>
>                 <data>
>                         <mid>
>                                 <val>128</val>
>                                 <desc>blah blah</desc>
>                         </mid>
>                         <pid>
>                                 <val>245</val>
>                                 <desc>Total Distance</desc>
>                         </pid>
>                         <val>1060771</val>
>                         <max>1060771</max>
>                         <min>0</min>
>                 </data>
>                 <data>
>                         <mid>
>                                 <val>128</val>
>                                 <desc>blah blah</desc>
>                         </mid>
>                         <pid>
>                                 <val>182</val>
>                                 <desc>Trip Fuel</desc>
>                         </pid>
>                         <val>0</val>
>                         <max>0</max>
>                         <min>0</min>
>                 </data>
>         </jibrish>
> </device>
> 
> --
> Scott
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to