Java XML Child Get by Name getChildElement(Node node)

Here you can find the source of getChildElement(Node node)

Description

get Child Element

License

Open Source License

Declaration

static public Element getChildElement(Node node) 

Method Source Code

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

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

import org.w3c.dom.Element;

public class Main {
    static public Element getChildElement(Node node) {
        NodeList nl = node.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            Node n = nl.item(i);//from  ww w . j  a  va 2s .co  m
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                return (Element) n;
            }
        }
        return null;
    }
}

Related

  1. getChildElement(final Element element, final String namespace, final String tagName)
  2. getChildElement(final Element parent, final String childName)
  3. getChildElement(final Element parent, final String ns, final String localName)
  4. getChildElement(final Node parent, final String name)
  5. getChildElement(final Node parentNode, final String childNodeName)
  6. getChildElement(Node node, String childName)
  7. getChildElement(Node parent, String childLocalName, String childNamespaceURI)
  8. getChildElement(Node parent, String childName)
  9. getChildElement(Node parent, String elementName)