in reply to Re: 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?

already tried that. don't change a thing ! tried quoting & as \& also but dint worked!

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

Replies are listed 'Best First'.
Re^3: How to modify an attribute containing special characters in a xml file?
by kcott (Archbishop) on Sep 30, 2016 at 12:11 UTC
    "... ! 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