Package de.xima.fc.gui.utils
Class DomUtil
java.lang.Object
de.xima.fc.gui.utils.DomUtil
Deprecated.
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatHtml
(Node node) Deprecated.Pretty prints the given HTML node.static void
setAttribute
(Element element, String name, String value) Deprecated.Assumes the implementation outputs the attribute as a double-quoted attribute.static void
Deprecated.Similar tosetText(Document, Element, String)
, but assumes the text to be set is JavaScript.static void
Deprecated.Adds the given text to the node as a child, escaping according to HTML rules.
-
Method Details
-
formatHtml
Deprecated.Pretty prints the given HTML node. Puts attributes on new lines.- Parameters:
node
- the node to format to html- Returns:
- The formatted HTML.
- Throws:
IOException
- Should not happen asByteArrayOutputStream
does not throw.
-
setText
Deprecated.Adds the given text to the node as a child, escaping according to HTML rules.- Parameters:
doc
- the document for which the node should be addedelement
- the element under which the text node should be appendedtext
- the text of the textnode
-
setJs
Deprecated.Similar tosetText(Document, Element, String)
, but assumes the text to be set is JavaScript. The text content of a script tag is CDATA, the string</script
(which can only occur in strings or regexps) is escaped by replacing it with \x3c/script.- Parameters:
doc
- the document for which the node should be addedelement
- the element under which the node should be appendedtext
- the javascript to set to the node
-
setAttribute
Deprecated.Assumes the implementation outputs the attribute as a double-quoted attribute. Only & and " need to be escaped for double-quoted attributes. See https://html.spec.whatwg.org/multipage/syntax.html#syntax-attributes Attribute values are a mixture of text and character references, except with the additional restriction that the text cannot contain an ambiguous ampersand. The attribute value, which, in addition to the requirements given above for attribute values, [begins with a single U+0022 QUOTATION MARK character (") and] must not contain any literal U+0022 QUOTATION MARK characters ("), and finally followed by a second single U+0022. QUOTATION MARK character (").- Parameters:
element
- Element on which to set an attribute.name
- Attribute name to set.value
- Attribute value to set.
-
SecureXmlFactories
,Jsoup
, orEncode.forHtml(String)
.