Class HtmlUtils
java.lang.Object
com.priint.pubserver.plugin.PluginControlDefault
com.priint.pubserver.comet.bridge.dataprocessing.HtmlUtils
- All Implemented Interfaces:
com.priint.pubserver.plugin.interfaces.PluginControl
public class HtmlUtils
extends com.priint.pubserver.plugin.PluginControlDefault
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic final StringencodeAsTaggedText(String input) Translator to escape non-ASCII chars to <0xNNNN>
Space adjacent to non-ASCII chars should also be escaped.static final StringescapeTaggedTextName(String input) Translator to escape reserved tagged text characters by backslash.
List of reserved characters: "?", "=", ":", "_", "/", "&", "%", "#"
Escaping is important in StyleNames and URLsgetAncestors(Element child, String... names) Get a list of all element ancestors of a child element.getElements(Element parent, String... names) Get a list of direct child element of a parent element.getRowsOfTable(Element table) Get all rows of a table in a list.static StringgetStringFromDoc(Document doc) Convert HTML DOM Document into XML String
Used for log outputstatic StringreplaceNamedEntities(String text) Replaces all keys in a texts by their values.static StringreplaceNumericEntities(String text) replaces numeric entities by their Unicode charactersMethods inherited from class com.priint.pubserver.plugin.PluginControlDefault
afterCreateConfigurations, afterDeleteConfigurations, afterUpdateConfigurations, createConfiguration, deleteConfigurations, getSession, getSessionId, initInstance, loadServerConfig, ping, readSessionAttribute, updateConfigurations, writeSessionAttributeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.priint.pubserver.plugin.interfaces.PluginControl
validateConfigurations
-
Method Details
-
getAncestors
Get a list of all element ancestors of a child element.Optionally filtered by tagNames.
- Parameters:
child-names- list of names to filter. If no names are given, all elements on the path will be retrieved. "*" is NOT supported as tagName.- Returns:
-
getRowsOfTable
Get all rows of a table in a list.All rows will be retrieved regardless of their parent node (can be table, thead, tbody or tfoot element).
- Parameters:
table-- Returns:
-
getElements
Get a list of direct child element of a parent element.Optionally filtered by tagNames.
- Parameters:
parent-names- list of names to filter. If no names are given, all element children will be retrieved. "*" is NOT supported as tagName.- Returns:
-
replaceNamedEntities
Replaces all keys in a texts by their values. Keys are identified by the first group in a regular expression match. Keys that are not contained in the replacement map are not replaced.Example:
replaceByMap("A${nbsp}C", "\\$\\{([A-Za-z]+)\\}", new HashMap<String, String>(){put("nbsp", "160"}));will return "A160C.
- Parameters:
text-- Returns:
- converted string
-
replaceNumericEntities
replaces numeric entities by their Unicode characters- Parameters:
text-- Returns:
- converted string
-
getStringFromDoc
Convert HTML DOM Document into XML String
Used for log output- Parameters:
doc-- Returns:
-
encodeAsTaggedText
Translator to escape non-ASCII chars to <0xNNNN>
Space adjacent to non-ASCII chars should also be escaped.- Parameters:
input-- Returns:
- encoded text
-
escapeTaggedTextName
Translator to escape reserved tagged text characters by backslash.
List of reserved characters: "?", "=", ":", "_", "/", "&", "%", "#"
Escaping is important in StyleNames and URLs
-