public class DomUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOGGER |
| Modifier | Constructor and Description |
|---|---|
protected |
DomUtils()
Disabled constructor, utility class.
|
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
checkPreconditions(Element element)
Checks if the element is null or does only contain whitespace text.
|
static String |
getAttributeText(Element element,
String tagName,
String attrName)
Get the attribute text of a single child of an element by its tag name.
|
static Element |
getChildByTagName(Element element,
String name)
Get a single child of an element by its tag name.
|
static List<Element> |
getChildrenByTagName(Element element,
String name)
Get the children of an element with a specified tag name.
|
static String |
getElementText(Element element,
String name)
Get the element text of a single child of an element by its tag name.
|
static Boolean |
toBoolean(Element element) |
static Boolean |
toBoolean(Element element,
String attributeName) |
static ISO_3166_1_alpha2 |
toCountry(Element element) |
static Date |
toDateFromSecondsTimestamp(Element element,
String attName) |
static Double |
toDouble(Element element) |
static Double |
toDouble(Element element,
String attributeName) |
static Float |
toFloat(Element element) |
static Float |
toFloat(Element element,
String attributeName) |
static URL |
toHttpURL(Element element) |
static Integer |
toInteger(Element element) |
static Integer |
toInteger(Element element,
String attributeName) |
static Long |
toLong(Element element) |
static Long |
toLong(Element element,
String attributeName) |
static String |
toNonEmptyString(Element element)
Retrieve the element body as a string.
|
static String |
toNonEmptyString(Element element,
String attributeName) |
static URI |
toURI(Element element) |
static URL |
toURL(Element element) |
public static String toNonEmptyString(Element element)
element - The element to process.public static ISO_3166_1_alpha2 toCountry(Element element)
public static Date toDateFromSecondsTimestamp(Element element, String attName)
public static Element getChildByTagName(Element element, String name)
element - The element to search the child for.name - The tag name of the child to search.public static String getElementText(Element element, String name)
element - The element to search the child for.name - The tag name of the child to search.public static String getAttributeText(Element element, String tagName, String attrName)
element - The element to search the child for.name - The tag name of the child to search.attrName - The name of the attribute.public static List<Element> getChildrenByTagName(Element element, String name)
element - The element to search the children for.name - The tag name of the children to search for.protected static boolean checkPreconditions(Element element)
element - The element to check.Copyright © 2013 dontdrinkandroot. All Rights Reserved.