Package org.spiderwiz.zutils
Class ZHtml
java.lang.Object
org.spiderwiz.zutils.ZHtml
public final class ZHtml extends Object
A utility class for generating simple HTML documents.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ZHtml.Anchor
Represents an anchor node (<a>
).class
ZHtml.Cell
Represents a table cell node (<td>
).class
ZHtml.Div
Represents a div element (<div>
).class
ZHtml.Document
Represents the root node of an HTML document.class
ZHtml.Heading
Represents a heading tag with a given level (<h
level>
).class
ZHtml.Node
Represents an HTML node.class
ZHtml.Paragraph
Represents a text paragraph (<p>
).class
ZHtml.Row
Represents a table row node (<tr>
).class
ZHtml.Styles
Predefined CSS styles.class
ZHtml.Table
Represents a table node (<table>
).class
ZHtml.TextNode
Represents a generic node that can be incrementally loaded with anything from plain text to nodes of other types. -
Method Summary
Modifier and Type Method Description static ZHtml.Document
createDocument()
Instantiates a new HTML Document node with no title.static ZHtml.Document
createDocument(String title)
Instantiates a new HTML Document node with the given title.static String
escape(String s)
Encode the give text as valid HTML visible textstatic String
toPlainText(String html)
Converts HTML code to plain text while preserving line breaks.
-
Method Details
-
createDocument
Instantiates a new HTML Document node with no title.- Returns:
- the document node.
-
createDocument
Instantiates a new HTML Document node with the given title.- Parameters:
title
- the title of the document.- Returns:
- the document node.
-
escape
Encode the give text as valid HTML visible text- Parameters:
s
- plain text- Returns:
- HTML text
-
toPlainText
Converts HTML code to plain text while preserving line breaks.- Parameters:
html
- HTML code to convert- Returns:
- the converted text.
-