| Author |
Escaping HTML Text
|
Corey McGlone
Ranch Hand
Joined: Dec 20, 2001
Posts: 3271
|
|
Is there something in the Java API that will take a String of HTML and escape all the special characters for you? For example, if I have a String that looks like this: <html> Can I pass that String to some method and get this back? & lt;html& gt; Thanks. Edit: I put spaces in the tags just so that they'd show properly instead of being converted to < and >, respectively. Hopefully, you get the idea. [ May 09, 2005: Message edited by: Corey McGlone ]
|
SCJP Tipline, etc.
|
 |
Darryl Pierce
Greenhorn
Joined: May 24, 2005
Posts: 1
|
|
Originally posted by Corey McGlone: Is there something in the Java API that will take a String of HTML and escape all the special characters for you? For example, if I have a String that looks like this: <html> Can I pass that String to some method and get this back? & lt;html& gt;
See String.replace()
|
"What do you care what other people think, Mr. Feynman?"
|
 |
Jeffrey Spaulding
Ranch Hand
Joined: Jan 15, 2004
Posts: 149
|
|
Hi, you might want to take a look at org.apache.commons.lang.StringEscapeUtils Its in Core Language Utilities The Apache Jakarta Commons Lang Library, version 2.0 Downloadable from http://jakarta.apache.org/commons/lang/ Enjoy, J.
|
 |
 |
|
|
subject: Escaping HTML Text
|
|
|