Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. function DecodeXML(string) {
  2. return string.replace(/'/g, "'")
  3. .replace(/"/g, '"')
  4. .replace(/>/g, '>')
  5. .replace(/&lt;/g, '<')
  6. .replace(/&amp;/g, '&');
  7. }
  8.  
  9. function EncodeXML(string) {
  10.  
  11. string = string.replace(/&/g, '&amp;')
  12. .replace(/</g, '&lt;')
  13. .replace(/>/g, '&gt;')
  14. .replace(/"/g, '&quot;')
  15. .replace(/'/g, '&apos;');
  16.  
  17. return string;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement