views:

119

answers:

1

ok, so i made a mini Rich text editor and if i want to insert a link i insert into the textarea the html like this: <a href=http://google.com&gt;go to google</a>, it works just fine but when i reopen that text for editing i don't get the complete html tag...all i get is go to google without <a href=http://google.com&amp;gt; and </a>. i have to mention that the text is stored in a xml document. Can someone tell me where the problem is and how should i do it to get the full <a href=http://google.com&gt;go to google</a> ? thanks

LATER EDIT: in my xml file special characters are escaped(ex: < becomes \&gt;)

+1  A: 

When embedding HTML in XML, try escaping the special characters (less than, greater than, and ampersand) as

  • &lt;
  • &gt;
  • &amp;
and how exactly should i do that? i tried something lilke: \<a href=\"http://google.com\"\>go to google\</a\> but with no success
kmunky
First, try removing the backslashes before the ampersands and the quotes. Backslashes are never used to escape things in XML. (And you don't need to escape the quotes.) I think the only things you can escape in XML are less than, greater than, and ampersand.Having said that, I don't think removing backslashes will solve your original problem. If escaping with ampersands doesn't work, I'm fresh out of ideas. :-(