Code example for Element

Methods: getAttributehasAttribute

		if (testNode.getNodeType() == Node.ELEMENT_NODE) {
			// Node to test is element 
			Element element = (Element) testNode;
			if (indexWildcard != -1) {
				// wildcard is defined in the attribute matcher. 
				if (element.hasAttribute(attrName)) {
					// element define, attribute, match is OK. 
					if (wildcardValues != null) {
						// wildcard values is filled, add the attribute value 
					// element tested define the attribute, match is OK 
					return true; 
				return false; 
			// No wildcard defined, test if element has attribute attrName and 
			// if value is OK. 
			String testAttrValue = element.getAttribute(attrName);
			return attrValue.equals(testAttrValue);
		return false; 
Stop searching for code, let great code find you!  Add Codota to your java IDE