|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.maven.doxia.util.HtmlTools
public class HtmlTools
The HtmlTools class defines methods to HTML handling.
| Method Summary | |
|---|---|
static String |
encodeId(String id)
Construct a valid id. |
static String |
encodeURL(String url)
Encode an url |
static String |
escapeHTML(String text)
Escape special HTML characters in a String in xml mode. |
static String |
escapeHTML(String text,
boolean xmlMode)
Escape special HTML characters in a String. |
static HTML.Tag |
getHtmlTag(String tagName)
Returns a tag for a defined HTML tag name. |
static boolean |
isId(String text)
Determines if the specified text is a valid id according to the rules laid out in encodeId(String). |
static char[] |
toChars(int codePoint)
Converts the given code point to an equivalent character array. |
static String |
unescapeHTML(String text)
Unescapes HTML entities in a string in non xml mode. |
static String |
unescapeHTML(String text,
boolean xmlMode)
Unescapes HTML entities in a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static HTML.Tag getHtmlTag(String tagName)
HtmlMarkup.
If the given name does not represent one of the defined tags, then
null will be returned.
tagName - the String name requested.
tagName,
or null if not found.public static String escapeHTML(String text)
xml mode.
Note: this method doesn't escape non-ascii characters by numeric characters references.
text - the String to escape, may be null.
escapeHTML(String,boolean)
public static String escapeHTML(String text,
boolean xmlMode)
< becomesIf<> becomes>& becomes&" becomes"' becomes'if xmlMode = true
xmlMode is true, every other character than the above remains unchanged,
if xmlMode is false, non-ascii characters get replaced by their hex code.
Note: all characters are encoded, i.e.:
ř = ř 𝟭 = 𝟭
text - The String to escape, may be null.xmlMode - true to replace also ' to &apos, false to replace non-ascii
characters by numeric characters references.
public static String unescapeHTML(String text)
text - the String to unescape, may be null.
String, null if null string input.unescapeHTML(String, boolean)
public static String unescapeHTML(String text,
boolean xmlMode)
Unescapes a string containing entity escapes to a string containing the actual Unicode characters corresponding to the escapes. Supports HTML 4.0 entities.
For example, the string "<Français>" will become "<Français>".
Note: all unicode entities are decoded, i.e.:ř = ř 𝟭 = 𝟭
text - the String to unescape, may be null.xmlMode - set to true to replace &apos by '.
String, null if null string input.public static String encodeURL(String url)
url - the String to encode, may be null
public static String encodeId(String id)
Note: this method is identical to
DoxiaUtils.encodeId( id, true),
the rules to encode an id are laid out there.
id - The id to be encoded.
DoxiaUtils.encodeId(java.lang.String,boolean)public static boolean isId(String text)
encodeId(String).
text - The text to be tested.
true if the text is a valid id, otherwise false.encodeId(String).public static char[] toChars(int codePoint)
codePoint - the code point to convert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||