Package de.xima.fc.gui.utils
Class DomUtil
- java.lang.Object
-
- de.xima.fc.gui.utils.DomUtil
-
@Deprecated public class DomUtil extends Object
Deprecated.Do not use these utility methods. Use other XML and HTML processing facilities, such asSecureXmlFactories
,Jsoup
, orEncode.forHtml(String)
.- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static 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
setJs(Document doc, Element element, String text)
Deprecated.Similar tosetText(Document, Element, String)
, but assumes the text to be set is JavaScript.static void
setText(Document doc, Element element, String text)
Deprecated.Adds the given text to the node as a child, escaping according to HTML rules.
-
-
-
Method Detail
-
formatHtml
public static String formatHtml(Node node) throws IOException
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
public static void setText(Document doc, Element element, String text)
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
public static void setJs(Document doc, Element element, String text)
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
public static void setAttribute(Element element, String name, String value)
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.
-
-