List of usage examples for org.w3c.dom Element hasAttribute
public boolean hasAttribute(String name);
true
when an attribute with a given name is specified on this element or has a default value, false
otherwise. From source file:Main.java
public static boolean hasAttribByName(Element node, String name) { return node.hasAttribute(name); }
From source file:Main.java
public static String getAttribute(Element e, String name, String defaultValue) { return (e.hasAttribute(name)) ? e.getAttribute(name) : defaultValue; }
From source file:Main.java
public static String getAttribute(Element element, String attributeName) { return (element.hasAttribute(attributeName) ? element.getAttribute(attributeName) : null); }
From source file:Main.java
public static void removeAttributeFromElement(Element element, String attr) { if (element != null && element.hasAttribute(attr)) { element.removeAttribute(attr);// w ww . java 2 s .com } }
From source file:Main.java
public static String attributeStringValue(Element e, String attr, String defaultValue) { if (!e.hasAttribute(attr)) { return defaultValue; }// w w w . j a va 2 s. c o m return e.getAttribute(attr); }
From source file:Main.java
public static String getTextAttribute(Element el, String attr, String defaultValue) { if (el.hasAttribute(attr)) { return el.getAttribute(attr); } else {//from www. j a va 2 s .c om return defaultValue; } }
From source file:Main.java
/** * Get the value of the specified attribute as a boolean. If the element has no attribute by the specified name, * false is returned./* ww w.j av a 2s . com*/ * * @param root The element. * @param attrName The attribute name. * @return True if the element has the attribute and its value is "true". */ public static boolean getAttrBoolean(Element root, String attrName) { if (root.hasAttribute(attrName)) return "true".equals(root.getAttribute(attrName).toLowerCase()); return false; }
From source file:Main.java
/** * Get the value of the specified attribute as an integer. If the element has no attribute by the specified name, 0 * is returned.// w w w .ja v a2s .co m * * @param root The element. * @param attrName The attribute name. * @return The value of the attribute, if it exists, 0 otherwise. */ public static int getAttrInt(Element root, String attrName) { if (root.hasAttribute(attrName)) return Integer.valueOf(root.getAttribute(attrName)).intValue(); return 0; }
From source file:Main.java
public static boolean attributeBooleanGet(Element e, String name, boolean defaultValue) { if (!e.hasAttribute(name)) { return defaultValue; } else {//from w ww . j a v a 2s . c o m return Boolean.parseBoolean(e.getAttribute(name)); } }
From source file:com.developmentsprint.spring.breaker.config.BreakerNamespaceHandler.java
public static String extractCircuitManager(Element element) { return (element.hasAttribute(BreakerNamespaceHandler.CIRCUIT_MANAGER_ATTRIBUTE) ? element.getAttribute(BreakerNamespaceHandler.CIRCUIT_MANAGER_ATTRIBUTE) : BreakerNamespaceHandler.DEFAULT_CIRCUIT_MANAGER_BEAN_NAME); }