Java examples for XML:XML Attribute
Checks if the XML Element contains any of the attributes contained in the list of labels.
//package com.java2s; import org.w3c.dom.Element; public class Main { /**/*w w w.j av a 2s. co m*/ * Checks if the Element contains any of the attributes contained in the * list of labels. * * @param element * The Element object. * @param labels * The list of string labels to test. * @return If the Element contains any of the labels specified. */ public static boolean hasAnyAttributes(Element element, String[] labels) { for (String label : labels) if (element.hasAttribute(label)) return true; return false; } }