Class HtmlNode
java.lang.Object
guideme.web.html.HtmlNode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable StringReturns the value of the attribute, or null if it isn't set or has no value.children()static StringescapeAttribute(String text) Escapes text for use in a quoted attribute value.static StringescapeHtml(String text) Escapes text for use in element content.final booleanhasAttribute(String name) abstract Stringname()Returns the name of the HTML tag or an empty string for text nodes.abstract StringReturns the HTML of this node and its descendants.final HtmlTagsetAttribute(String name, float value) final HtmlTagsetAttribute(String name, int value) abstract HtmlTagsetAttribute(String name, String value) Sets an attribute.static HtmlTagCreates an element.static HtmlTagtag(String name, HtmlFragment fragment) static HtmlTagstatic HtmlTagstatic HtmlTextCreates a text node, whose content is escaped when written.abstract StringReturns the text of this node and its descendants, without markup.
-
Constructor Details
-
HtmlNode
public HtmlNode()
-
-
Method Details
-
name
Returns the name of the HTML tag or an empty string for text nodes.- Returns:
- the name of the HTML tag or an empty string for text nodes
-
attribute
-
hasAttribute
-
setAttribute
Sets an attribute. A null value writes the attribute without a value (i.e.<details open>).- Throws:
UnsupportedOperationException- For text nodes.
-
setAttribute
-
setAttribute
-
tag
Creates an element.- Throws:
IllegalArgumentException- If the name is not a valid tag name.
-
tag
-
tag
-
tag
-
text
-
children
-
escapeHtml
-
escapeAttribute
-
textContent
Returns the text of this node and its descendants, without markup.- Returns:
- the text of this node and its descendants, without markup
-
outerHtml
Returns the HTML of this node and its descendants.- Returns:
- the HTML of this node and its descendants
-