Android XML Node Attribute Get findNextElementWithAttribute(Node ret, String name, String attribute, String value)

Here you can find the source of findNextElementWithAttribute(Node ret, String name, String attribute, String value)

Description

find Next Element With Attribute

Declaration

public static Element findNextElementWithAttribute(Node ret,
            String name, String attribute, String value) 

Method Source Code

//package com.java2s;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class Main {
    public static Element findNextElementWithAttribute(Node ret,
            String name, String attribute, String value) {
        ret = ret.getNextSibling();/*  w ww .j ava 2  s.  c  o m*/
        while (ret != null
                && (!(ret instanceof Element)
                        || !ret.getNodeName().equals(name)
                        || ((Element) ret).getAttribute(attribute) == null || !((Element) ret)
                        .getAttribute(attribute).equals(value))) {
            ret = ret.getNextSibling();
        }
        return (Element) ret;
    }
}

Related

  1. getElementIntAttr(Node element, String attrName)
  2. getEnumAttribute(Node archiveNode, String attrName, Object[] values, Object defaultValue)
  3. getNodeAttribute(Node node, String name)
  4. getNodeAttribute(Node node, String name, String def)
  5. nodeMatchesAttributeFilter(Node node, String attributeName, List attributeValues)