Modifier and Type | Method and Description |
---|---|
static Optional<Element> |
fromJsoup(org.jsoup.nodes.Node node)
Converts a given JSoup
Node and its children into
a matching Element hierarchy. |
static boolean |
isCustomElement(Element element)
Checks whether the given element is a custom element or not.
|
static boolean |
isScript(Element element)
Checks whether the given element is a
script or not. |
static boolean |
isValidAttributeName(String attribute)
Checks if the given attribute name is valid.
|
static boolean |
isValidStylePropertyName(String name)
Checks if the given style property name is valid.
|
static boolean |
isValidStylePropertyValue(String value)
Checks if the given style property value is valid.
|
static boolean |
isValidTagName(String tag)
Checks if the given tag name is valid.
|
static void |
setComponent(Element element,
Component component)
Defines a mapping between this element and the given
Component . |
static org.jsoup.nodes.Node |
toJsoup(org.jsoup.nodes.Document document,
Element element)
Converts the given element and its children to a JSoup node with
children.
|
static void |
validateStylePropertyName(String name)
Validates the given style property name and throws an exception if the
name is invalid.
|
static void |
validateStylePropertyValue(String value)
Checks if the given style property value is valid.
|
public static boolean isValidTagName(String tag)
tag
- the tag namepublic static boolean isValidAttributeName(String attribute)
attribute
- the name of the attribute in lower casepublic static void validateStylePropertyName(String name)
name
- the style property name to validatepublic static boolean isValidStylePropertyName(String name)
name
- the name to validatepublic static boolean isValidStylePropertyValue(String value)
value
- the value to validatepublic static void validateStylePropertyValue(String value)
Throws an exception if it's certain the value is invalid
value
- the value to validatepublic static void setComponent(Element element, Component component)
Component
.
An element can only be mapped to one component and the mapping cannot be
changed. The only exception is Composite
which can overwrite the
mapping for its content.
element
- the element to map to the componentcomponent
- the component this element is attached topublic static org.jsoup.nodes.Node toJsoup(org.jsoup.nodes.Document document, Element element)
document
- A JSoup documentelement
- The element to convertpublic static Optional<Element> fromJsoup(org.jsoup.nodes.Node node)
Node
and its children into
a matching Element
hierarchy.
Only nodes of type TextNode
and
Element
are converted - other node types return
an empty optional.
node
- JSoup node to convertpublic static boolean isCustomElement(Element element)
Custom elements (Web Components) are recognized by having at least one dash in the tag name.
element
- the element to checktrue
if a custom element, false
if notpublic static boolean isScript(Element element)
script
or not.element
- the element to checktrue
if a script, false
if notCopyright © 2020. All rights reserved.