in reply to Re^2: How to modify an attribute containing special characters in a xml file?
in thread How to modify an attribute containing special characters in a xml file?

"... ! tried quoting & as \& also but dint worked!"

Firstly, see ++Corion's response to you in this thread (to which you replied "ok got your point ...").

The code I posted in "Syntax-highlight Non-Perl Code for HTML" has, near the start:

{ my %entity_for = qw{& &amp; < &lt; > &gt;}; sub chars_to_ents { $_[0] =~ s/([&<>])/$entity_for{$1}/gr } }

You'll find usage near the end of the script. Perhaps you could write somethng like this tailored to your needs.

— Ken

  • Comment on Re^3: How to modify an attribute containing special characters in a xml file?
  • Download Code