Methods Summary |
---|
public Element | getBody()
return body;
|
public java.lang.String | getDoctype()
return doctype;
|
public Element | getHead()
return head;
|
public void | set(Element head, Element body)
if (head == null) {
throw new NullPointerException("Head element is null.");
}
if (body == null) {
throw new NullPointerException("Body element is null.");
}
// Check the element names.
if (!head.getName().equalsIgnoreCase(HTMLReportConstants.HEAD)) {
new HTMLElement("HEAD").add(head);
}
if (!body.getName().equalsIgnoreCase(HTMLReportConstants.BODY)) {
new HTMLElement("BODY").add(head);
}
// Discard old elements.
List<Element> elements = html.getElements("BODY");
for (Element element : elements) {
html.delete(element);
} // Loop discarding body elements.
elements = html.getElements("HEAD");
for (Element element : elements) {
html.delete(element);
} // Loop discarding head elements.
// Add the new elements.
html.add(head);
html.add(body);
this.head = head;
this.body = body;
|
public void | setDoctype(java.lang.String raw)
if (raw == null) {
throw new NullPointerException("Doctype string is null.");
}
doctype = raw;
|
public java.lang.String | toString()
StringBuffer buf = new StringBuffer();
buf.append("<!DOCTYPE html PUBLIC \"")
.append(Escape.getInstance().encodeEntities(doctype, ""))
.append("\">\n")
.append(html.toString());
return buf.toString();
|
public void | write(java.io.Writer output)
output.append("<!DOCTYPE html PUBLIC \"")
.append(Escape.getInstance().encodeEntities(doctype, ""))
.append("\">\n")
.append(html.toString());
output.flush();
|
public void | write(java.io.File file)
FileWriter fw = new FileWriter(file);
write(fw);
fw.close();
|