Java XML NodeList searchDialogByName(NodeList nodeList, String id)

Here you can find the source of searchDialogByName(NodeList nodeList, String id)

Description

search Dialog By Name

License

Open Source License

Declaration

public static Node searchDialogByName(NodeList nodeList, String id) 

Method Source Code

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

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static Node searchDialogByName(NodeList nodeList, String id) {
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node node = nodeList.item(i);
            String idd = getNodeAttributeValue(node, "id");
            if (id.equals(idd))
                return node;
        }/*from w  w  w .ja  va 2  s.  c  om*/
        return null;
    }

    public static String getNodeAttributeValue(Node node, String attributeName) {
        NamedNodeMap attributes = node.getAttributes();
        if (attributes == null)
            return null;

        Node attributeValue = attributes.getNamedItem(attributeName);
        return attributeValue == null ? null : attributeValue.getNodeValue();
    }
}

Related

  1. removeBlankTextNode(NodeList nodes)
  2. removeNodeListContent(NodeList nodeList)
  3. replace(Node src, NodeList nodes)
  4. replaceElement(Element oldElement, NodeList newNodes)
  5. replaceElement(Element oldElement, NodeList newNodes)
  6. selectElement(NodeList nodeList, String name)
  7. size(final NodeList nodeList)
  8. sort(NodeList classesNodeList)
  9. stream(NodeList list)