Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have no choice but remove or ignore this line. Is there a way to tell XML::XPATH to ignore this first lineencoding specified in XML declaration is incorrect at line 1, column 3 +0, byte 30: <?xml version="1.0" encoding="utf-16"?>
and start after that? If not, how would you approach this situation to get rid of this first line and process the rest of file?<?xml version="1.0" encoding="utf-16"?>
Thnaks for looking!#!/usr/bin/perl use strict; use warnings; use XML::XPath; my $xp = XML::XPath->new(filename => '/xml_test.xml'); foreach my $row ($xp->findnodes('/HOME/Account')) { my $nodeset = $row->find('Record'); foreach my $node ( $nodeset->get_nodelist ) { my $account = $node->find( 'accnumber')->string_value; print "\n $account \n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Stripping off the first line of file help!
by Sinistral (Monsignor) on Mar 02, 2011 at 14:41 UTC | |
|
Re: Stripping off the first line of file help!
by roboticus (Chancellor) on Mar 02, 2011 at 14:40 UTC | |
|
Re: Stripping off the first line of file help!
by fidesachates (Monk) on Mar 02, 2011 at 17:26 UTC | |
|
Re: Stripping off the first line of file help!
by anonymized user 468275 (Curate) on Mar 02, 2011 at 17:05 UTC | |
by Anonymous Monk on Mar 03, 2011 at 16:11 UTC |