Jonathan Dudson wrote:
> 
> no element found at line 1, column 0, byte 0:
> 
> at 
> /usr/lib/perl5/vendor_perl/5.8.8/i586-linux-thread-multi/XML/Parser.pm 
> line 187

Run the below code and data and see if you get a different result - if so,
we can talk about versions and platforms etc:

Ran the following script on Perl 5.8 B820:

#!perl --

use strict;
use warnings;
use XML::Parser;
use XML::SimpleObject;
use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Sortkeys=1;

my $xml_file_path = 'foo.xml';

my $parser = XML::Parser->new(ErrorContext => 2, Style => "Tree");

# make the xml accessable from OO type calls

my $xmlobj = XML::SimpleObject->new($parser->parsefile($xml_file_path));

# for every <DataRow> tag assign it to $objDataBlock

foreach my $objDataBlock ($xmlobj->child("Report")->children("DataRow")) {
        print Data::Dumper->Dump([$objDataBlock], [qw($objDataBlock)]);
}

__END__

Got this output:

$objDataBlock = bless( {
   'TelephoneNumber' => [
     bless( {
       '_ATTRS' => {},
       '_NAME' => 'TelephoneNumber',
       '_VALUE' => '123......'
     }, 'XML::SimpleObject' )
   ],
   '_ATTRS' => {},
   '_NAME' => 'DataRow',
   '_VALUE' => '

'
}, 'XML::SimpleObject' );

using your data file:

<Report>
<DataRow>
<TelephoneNumber>123......</TelephoneNumber>
</DataRow>
</Report>



_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to