line should be:
print $mail->child('smtp_server')->value;
not
print $mail->child('smtp_server')->{VALUE};
On 13 Jun 2001 20:25:18 +0000, Stout, Joel R wrote:
> I took the example from
> http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html
> I wanted something really simple for XML parsing that basically just reads
> values. But I'm stuck (again).
>
> #Here's what I'm trying to run:
>
> #!c:\perl\perl.exe
>
> use XML::Parser;
> use XML::SimpleObject;
> use strict;
>
> my $file = 'c:\perl\work\job001_card.xml';
>
> my $parser = XML::Parser->new(ErrorContext => 2, Style => "Tree");
> my $xso = XML::SimpleObject->new( $parser->parsefile($file) );
>
> foreach my $mail ($xso->child('job_card')->children('email')) {
> print "SMTP server: ";
> print $mail->child('smtp_server')->{VALUE};
> print "\n";
> }
>
> #and I get
> 'SMTP server: <blank>'
>
> #Here's an excerpt of the file I've been given:
> <job_card>
> <process_name>xxxxxx</process_name>
> <ftp_site type="incoming">
> <server>ftp.xxxxxxx.com</server>
> <user>pxxxxx</user>
> <password>fxxxxx</password>
> <folder>.</folder>
> <skip_file></skip_file>
> </ftp_site>
> <file_move>
> <file_dest>c:\test</file_dest>
> <file_ext>.xxx</file_ext>
> </file_move>
> <log_file>c:\perl\log</log_file>
> <email>
> <smtp_server>mxxxxx.exxxxx.com</smtp_server>
> ...
> </email>
> ...
> </job_card>
>
> #I think I'm close. When I add -w I get:
> 'use of uninitialized value in print at line 14 ...'
> #but I know there's a value for that tag. ???
--
Today is Prickle-Prickle, the 18th day of Confusion in the YOLD 3167
Kallisti!