Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 334259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:02:15+00:00 2026-05-12T10:02:15+00:00

Below is the script I have written to change the value of one of

  • 0

Below is the script I have written to change the value of one of the parameter in an XML file situated at a different location:

#!/usr/bin/perl -w

use Cwd;
use XML::Simple;
use Data::Dumper;
no warnings;

my $before_upgrade_value = &pre_upgrade_value;
print "Value before upgrade:: $before_upgrade_value \n";

&change_value ($before_upgrade_value);

&change_value ("America");

my $after_upgrade_value = &pre_upgrade_value;

print "Value after upgrade:: $after_upgrade_value \n";
print "Done \n";

sub pre_upgrade_value {
    my $xml = new XML::Simple;

    # read XML file
    my $input_xml  = "/usr/tmp/country/CountryConfig.xml";

    my $data = $xml->XMLin($input_xml);
    my $arg0 = $data->{COMMON}->{COUNTRY_LIST}->{Value};

    print "Arg0 is $arg0 \n";
    return $arg0;
}

sub change_value {
    my $arg0 = shift;

    my $arg1 = "ENGLAND";

    my $arg2 = "/usr/tmp/country/CountryConfig.xml";

    system("perl -pi -e 's/$arg0/$arg1/' $arg2");
}

But I am getting the following error:

Unable to recognise encoding of this document at /usr/local/lib/perl5/site_perl/5.8.7/XML/SAX/PurePerl/EncodingDetect.pm line 100. Document requires an element [Ln: 1, Col: 0]

Can you tell me the reason as I am not calling EncodingDetect.pm in my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:02:15+00:00Added an answer on May 12, 2026 at 10:02 am

    XML::SAX is used by XML::Simple. From the code:

    # XML::Simple requires the services of another module that knows how to parse
    # XML.  If XML::SAX is installed, the default SAX parser will be used,
    # otherwise XML::Parser will be used.
    

    A part of XML::SAX is XML::SAX::PurePerl::EncodingDetect. It sounds like you have some whitespace at the start of your XML, you may find this PerlMonks node helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following script below where I try to mimic a file upload
I have Javascript as below: <script type="text/javascript" language="javascript"> function redirectToPrevious(abcURL) { window.location.replace(abcURL); } function
I have a file download script that I have written, which reads files from
I have written a Perl script to read the configuration file and create CGI
I have written a PHP script below try to Post the JSON encoded string
I have written the script run.sh below for calling a java class : java
I have written a form which has 3 text inputs and one file input.
I have written below code: <script type=text/javascript> function testGenerator() { yield first; document.write(step1); yield
I have written the script below to generate all possible permutations of a specified
I have written a little bash script that reads commands (one per line), in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.