Escaping apostrophe using shell script

Hi,

I am using the KSH shell. I am facing a problem of escaping apostrophe('), that is occuring in a variable.
I used the following command, but in vain

item=`echo $item|sed 's/'/\'/g'`

this code replaces the occurance of ' in an xml file to apostrophe(') symbol.
The output of the above piece of code is
sed: command garbled: s/'/\/g

Please Help,

Thanks in advance

MK

Try putting the single quote into a variable (then you need to replace the single quotes around the sed commands with double to get the variable expanded)

Code
qot="'"
item=`echo $item|sed "s/'/$qot/g"`
print $item

cheers

Thanks a ton,

MK