com.sun.lwuit.html
Class HTMLUtils

java.lang.Object
  extended by com.sun.lwuit.html.HTMLUtils

public class HTMLUtils
extends java.lang.Object

This class contains several useful static methods for HTML


Method Summary
static java.lang.String convertCharEntity(java.lang.String charEntity, boolean lookupHTMLentities, java.util.Hashtable userDefinedCharEntities)
          Converts a char entity to the matching character or string.
static java.lang.String convertHTMLCharEntity(java.lang.String charEntity)
          Converts an HTML char entity to the matching character or string.
static java.lang.String convertXMLCharEntity(java.lang.String charEntity)
          Converts an XML char entity to the matching character or string.
static java.lang.String encodeString(java.lang.String str)
          Encodes the specified string to "percent-encoding" or URL encoding.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

convertXMLCharEntity

public static java.lang.String convertXMLCharEntity(java.lang.String charEntity)
Converts an XML char entity to the matching character or string. This is a convenience method that uses convertCharEntity with false for lookupHTMLentities and a null userDefinedCharEntities

Parameters:
charEntity - The char entity to convert (Not including the & and ;)
Returns:
A string containing a single char, or the original char entity string (with & and ;) if the char entity couldn't be resolved

convertHTMLCharEntity

public static java.lang.String convertHTMLCharEntity(java.lang.String charEntity)
Converts an HTML char entity to the matching character or string. This is a convenience method that uses convertCharEntity with true for lookupHTMLentities and a null userDefinedCharEntities

Parameters:
charEntity - The char entity to convert (Not including the & and ;)
Returns:
A string containing a single char, or the original char entity string (with & and ;) if the char entity couldn't be resolved

convertCharEntity

public static java.lang.String convertCharEntity(java.lang.String charEntity,
                                                 boolean lookupHTMLentities,
                                                 java.util.Hashtable userDefinedCharEntities)
Converts a char entity to the matching character or string. This handles both numbered and symbol char entities (The latter is done via getCharEntityCode)

Parameters:
charEntity - The char entity to convert (Not including the & and ;)
lookupHTMLentities - true to include the basic HTML named char entities (unicode 160-255), false otherwise
userDefinedCharEntities - A hashtable containing (String,int) dentoing the char entity name and its unicode
Returns:
A string containing a single char, or the original char entity string (with & and ;) if the char entity couldn't be resolved

encodeString

public static java.lang.String encodeString(java.lang.String str)
Encodes the specified string to "percent-encoding" or URL encoding. This encodes reserved, unsafe and unicode characters

Parameters:
str - The string to be encoded
Returns:
A percent-encoding of the string (safe characters remain the same)