Java XML Element Root getElement(String elementName, Node rootNode)

Here you can find the source of getElement(String elementName, Node rootNode)

Description

get Element

License

Mozilla Public License

Declaration

public static Node getElement(String elementName, Node rootNode) 

Method Source Code

//package com.java2s;
//License from project: Mozilla Public License 

import org.w3c.dom.Node;

public class Main {
    public static Node getElement(String elementName, Node rootNode) {
        Node node = rootNode.getFirstChild();
        while (node != null) {
            if (node.getNodeName().equalsIgnoreCase(elementName)) {
                return node;
            }//  ww w.j a  v  a 2s.c  o m

            node = node.getNextSibling();
        }

        return null;
    }
}

Related

  1. createRoot(Document document, String title)
  2. createRootElement(Document doc, String name)
  3. createRootElement(Document doc, String name)
  4. createRootElement(Document doc, String rootTagName)
  5. getElementData(final Element root, final String elementName)
  6. getElementData(final Element root, final String elementName)
  7. getElementText(String elemName, Element root, boolean trim)
  8. getElementValue(Element root, String name)