Java Utililty Methods XML Element Check

List of utility methods to do XML Element Check

  1. HOME
  2. Java
  3. X
  4. XML Element Check

Description

The list of methods to do XML Element Check are organized into topic(s).

Method

boolean is(final Element e, final String tag)
is
return e.getTagName().equalsIgnoreCase(tag);
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 isAsyncEventQueue(Element element)
is Async Event Queue
return ASYNC_EVENT_QUEUE_ELEMENT_NAME.equals(element.getLocalName());
boolean isComputedGoal(final Element element)
Check if an element describes a computed goal or not.
return "computedGoal".equals(element.getNodeName());
boolean isElement(XMLStreamReader xmlRdr, int eventType, String tagName)
is Element
int event = xmlRdr.getEventType();
if (event == eventType) {
 String locName = xmlRdr.getLocalName();
 if (locName.equals(tagName))
 return true;
return false;
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 isElementNamed(Element e, String ns, String localName)
Shortcut for checking a DOM element node's namespace and local name
return (e != null && safeCompare(ns, e.getNamespaceURI()) && safeCompare(localName, e.getLocalName()));
boolean isEmpty(final Element el)
See if this node is empty
return !hasChildren(el) && !hasContent(el);
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) {
...


AltStyle によって変換されたページ (->オリジナル) /