public class HtmlDomUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.nio.charset.Charset |
ENC
Standard character encoding we prefer (UTF-8).
|
static java.lang.String |
HTML_STRICT
DOCTYPE for a standards mode HTML document.
|
Constructor and Description |
---|
HtmlDomUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addHidden(org.w3c.dom.Element form,
java.lang.String name,
java.lang.String value)
Append an HTML <input type="hidden"> to the form.
|
static org.w3c.dom.Document |
clone(org.w3c.dom.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 org.w3c.dom.Element |
find(org.w3c.dom.Node parent,
java.lang.String name)
Find an element by its "id" attribute; null if no element is found.
|
static org.w3c.dom.Document |
newDocument()
Construct a new empty document.
|
static org.w3c.dom.Document |
parseFile(java.lang.Class<?> context,
java.lang.String name)
Parse an XHTML file from our CLASSPATH and return the instance.
|
static org.w3c.dom.Document |
parseFile(java.nio.file.Path path)
Parse an XHTML file from the local drive and return the instance.
|
static java.lang.String |
readFile(java.lang.Class<?> context,
java.lang.String name)
Read a Read a UTF-8 text file from our CLASSPATH and return it.
|
static java.lang.String |
readFile(java.nio.file.Path parentDir,
java.lang.String name)
Read a UTF-8 text file from the local drive.
|
static java.lang.String |
toString(org.w3c.dom.Document hostDoc)
Convert a document to a String, assuming later encoding to UTF-8.
|
static byte[] |
toUTF8(org.w3c.dom.Document hostDoc)
Convert a document to a UTF-8 byte sequence.
|
public static final java.nio.charset.Charset ENC
public static final java.lang.String HTML_STRICT
public static byte[] toUTF8(org.w3c.dom.Document hostDoc) throws java.io.IOException
java.io.IOException
public static byte[] compress(byte[] raw) throws java.io.IOException
java.io.IOException
public static java.lang.String toString(org.w3c.dom.Document hostDoc) throws java.io.IOException
java.io.IOException
public static org.w3c.dom.Element find(org.w3c.dom.Node parent, java.lang.String name)
public static void addHidden(org.w3c.dom.Element form, java.lang.String name, java.lang.String value)
public static org.w3c.dom.Document newDocument()
public static org.w3c.dom.Document clone(org.w3c.dom.Document doc) throws java.io.IOException
java.io.IOException
public static org.w3c.dom.Document parseFile(java.lang.Class<?> context, java.lang.String name) throws java.io.IOException
java.io.IOException
public static java.lang.String readFile(java.lang.Class<?> context, java.lang.String name) throws java.io.IOException
java.io.IOException
public static org.w3c.dom.Document parseFile(java.nio.file.Path path) throws java.io.IOException
java.io.IOException
public static java.lang.String readFile(java.nio.file.Path parentDir, java.lang.String name) throws java.io.IOException
java.io.IOException