The list of methods to do XML Element Check are organized into topic(s).
boolean
isAncestor(Element candAnc, Node cand) Check, if a given DOM element is an ancestor of a given node.
Node currPar = cand.getParentNode();
while (currPar != null) {
if (candAnc == currPar)
return true;
currPar = currPar.getParentNode();
return false;
boolean
isAppearanceTag(Element e) is Appearance Tag
if (e.getTagName().matches("H[1-9]")) {
return true;
if (e.getTagName().equals("FONT") && !e.getAttribute("COLOR").equals("")) {
return true;
if (e.getTagName().matches("[B|I|STRONG]")) {
return true;
...
boolean
isElementExistsByTagName(final Element element, final String tagName) Checks if is element exists by tag name.
if (element == null || tagName == null || tagName.isEmpty()) {
return false;
final NodeList res = element.getChildNodes();
for (int i = 0; i < res.getLength(); i++) {
final Node node = res.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
final Element elem = (Element) node;
...
boolean
isEmptyElement(Element el) Check that an element is empty, i.e., it contains no non-whitespace text or elements as children.
NodeList nl = el.getChildNodes();
int len = nl.getLength();
for (int i = 0; i < len; ++i) {
switch (nl.item(i).getNodeType()) {
case Node.CDATA_SECTION_NODE:
case Node.TEXT_NODE:
String s = nl.item(i).getNodeValue();
if (s != null && s.trim().length() > 0) {
...