|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gerrit.httpd.HtmlDomUtil
public class HtmlDomUtil
Utility functions to deal with HTML using W3C DOM operations.
| Field Summary | |
|---|---|
static String |
ENC
Standard character encoding we prefer (UTF-8). |
static String |
HTML_STRICT
DOCTYPE for a standards mode HTML document. |
| Constructor Summary | |
|---|---|
HtmlDomUtil()
|
|
| Method Summary | |
|---|---|
static void |
addHidden(Element form,
String name,
String value)
Append an HTML <input type="hidden"> to the form. |
static Document |
clone(Document doc)
Clone a document so it can be safely modified on a per-request basis. |
static byte[] |
compress(byte[] raw)
Compress the document. |
static Element |
find(Node parent,
String name)
Find an element by its "id" attribute; null if no element is found. |
static Document |
newDocument()
Construct a new empty document. |
static Document |
parseFile(Class<?> context,
String name)
Parse an XHTML file from our CLASSPATH and return the instance. |
static Document |
parseFile(File path)
Parse an XHTML file from the local drive and return the instance. |
static String |
readFile(Class<?> context,
String name)
Read a Read a UTF-8 text file from our CLASSPATH and return it. |
static String |
readFile(File parentDir,
String name)
Read a UTF-8 text file from the local drive. |
static String |
toString(Document hostDoc)
Convert a document to a String, assuming later encoding to UTF-8. |
static byte[] |
toUTF8(Document hostDoc)
Convert a document to a UTF-8 byte sequence. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ENC
public static final String HTML_STRICT
| Constructor Detail |
|---|
public HtmlDomUtil()
| Method Detail |
|---|
public static byte[] toUTF8(Document hostDoc)
throws IOException
IOException
public static byte[] compress(byte[] raw)
throws IOException
IOException
public static String toString(Document hostDoc)
throws IOException
IOException
public static Element find(Node parent,
String name)
public static void addHidden(Element form,
String name,
String value)
public static Document newDocument()
public static Document clone(Document doc)
throws IOException
IOException
public static Document parseFile(Class<?> context,
String name)
throws IOException
IOException
public static String readFile(Class<?> context,
String name)
throws IOException
IOException
public static Document parseFile(File path)
throws IOException
IOException
public static String readFile(File parentDir,
String name)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||