public class DOMHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DOMHelper.Table
Parses an (html)-file for a table with a given ID.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
TD
The tag denoting a table column.
|
static String |
TR
The tag denoting a table row.
|
| Constructor and Description |
|---|
DOMHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Element |
addTextNode(Element parent,
String text)
Adds a single text node to this element.
|
static List<String> |
getStringsFromElements(List<Node> scan)
Converts a list of elements that have a text node as their first child to
a list of the text values of these child nodes.
|
static List<List<String>> |
getTable(Element tab)
Scans a table element for entries, returns each table row (tr) as a list
of strings, the elements in this list are the td tags.
|
static List<String> |
getTextElementContent(Node xml,
String tagname)
Scans the DOM for all occurences of the element with the given name.
|
static List<Node> |
getTextElements(Node xml,
String tagname)
Scans the DOM for all occurrences of elements with the given tag name.
|
static String |
singleAttribute(Node xml,
String tag,
String att)
Scans the node for the sole occurence of the stated element.
|
static Element |
singleElement(Node xml,
String tagname)
Scans the node for the occurence of the given element.
|
static String |
singleText(Node xml,
String tagname)
Scans the node for the occurrence of the given element.
|
static String |
toElementName(String upper)
Converts a string into a typical element notation, thus to lower case
except the starting char.
|
public static final String TR
public static final String TD
public static final String singleText(Node xml, String tagname)
xml - Either an Element or a Documentpublic static final String toElementName(String upper)
public static final Element singleElement(Node xml, String tagname)
public static final String singleAttribute(Node xml, String tag, String att)
public static final List<Node> getTextElements(Node xml, String tagname)
public static final List<String> getStringsFromElements(List<Node> scan)
public static final List<String> getTextElementContent(Node xml, String tagname)
getTextElements(org.w3c.dom.Node, java.lang.String) and
getStringsFromElements(java.util.List<org.w3c.dom.Node>).public static List<List<String>> getTable(Element tab)