How To Parse Xml With Special Character? Specifically For Ampersand
I am getting data from text box and change it into xml format and store it in data base. For allowing special characters i wrote javascript function to replace special character wi
Solution 1:
Start with replacing the &
character, then replace the other characters. Otherwise you will replace &
from the previous entities (<
etc.) by &
string.replace(/&/g, '&amp;') //<= start with
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, '&apos');
// ' may be "\\'", depends on how te OP wants to use it
[edit based on comments] use &amp;
to replace the ampersand character
Post a Comment for "How To Parse Xml With Special Character? Specifically For Ampersand"