in reply to XML package for parsing values in the opening tag.
XML::Simple will do the job nicely. The following code
produces as output on your example:#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use XML::Simple; my $xml = XMLin('login.xml'); print Dumper($xml);
$VAR1 = { 'LOGIN' => { 'firstName' => 'Alice', '_AgeAtApplicationYears' => '33', 'phone' => '111-111-1111', 'state' => 'HI', 'zip' => '11111', 'userName' => 'testUser', 'lastName' => 'Firstimer', 'address' => '111 test street' } };
To access e.g. the 'state' attribute, use $xml->{LOGIN}->{state}
Hope this helps, -gjb-
Update: What you call 'embedded tags' are actually termed attributes in XML speak ;)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: XML package for parsing values in the opening tag.
by dwatson06 (Friar) on Apr 14, 2004 at 14:30 UTC |
In Section
Seekers of Perl Wisdom