Java XML NodeList findNode(String id, NodeList orgs)

Here you can find the source of findNode(String id, NodeList orgs)

Description

find Node

License

Apache License

Declaration

public static Node findNode(String id, NodeList orgs) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static Node findNode(String id, NodeList orgs) {
        Node org = null;//w  w w.ja va  2s.co m
        for (int i = 0; i < orgs.getLength(); i++) {
            NamedNodeMap attr = orgs.item(i).getAttributes();
            if (attr.getNamedItem("xml:id") == null) {
                continue;
            }
            if (attr.getNamedItem("xml:id").getNodeValue().equals(id)) {
                org = orgs.item(i);
                break;
            }
        }
        return org;
    }
}

Related

  1. fillHashtable(NodeList list, Hashtable fillIn)
  2. findElement(NodeList elements, String elementName)
  3. findElementsIgnoreCase(String name, NodeList nodes)
  4. findNode(NodeList nodeList, String nodeName)
  5. findNode(NodeList nodes, String nodeName)
  6. findNodeByName(NodeList nodeList, String name)
  7. getAllNodes(NodeList nodeList, List nodes)
  8. getArray(NodeList nodeList)
  9. getArray(NodeList nodeList)