Java XML Element Get by Attribute getElementByAttributeValue(List elements, String attName, String attValue)

Here you can find the source of getElementByAttributeValue(List elements, String attName, String attValue)

Description

get Element By Attribute Value

License

Open Source License

Declaration

public static Element getElementByAttributeValue(List<Element> elements, String attName, String attValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

import org.w3c.dom.Element;

public class Main {
    public static Element getElementByAttributeValue(List<Element> elements, String attName, String attValue) {
        for (Element e : elements) {
            String s = e.getAttribute(attName);
            if (attValue.equals(s))
                return e;
        }//w  ww.j  ava2 s.co m
        return null;
    }
}

Related

  1. findElementWithUniqueAttribute(Element root, String elementName, String attribute, String attributeValue)
  2. findNode(Node node, String attr, String value)
  3. findNodeByAttributeValue(NodeList nodeList, String attributeName, String attributeValue)
  4. getElementByAttribute(Element root, String tagname, String attribute, String att_value)
  5. getElementByAttribute(String attr, String value, Element root)
  6. getElementByAttributeValue(Node start, String tagName, String attrName, String attrValue)
  7. getElementIntAttribute(Element e, String whichAttribute)
  8. getElementsWithAttribute(Element element, String attribute)
  9. getElementsWithAttribute(Element element, String namespaceURI, String localName, String value, Collection elements)