Java tutorial
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public final static Element firstChild(Element root, String ns, String path) { String names[] = path.split("/"); for (int i = 0; i < names.length; i++) { String name = names[i]; NodeList nl = root.getElementsByTagNameNS(ns, name); if (nl == null) { return null; } int len = nl.getLength(); if (len < 1) { return null; } root = (Element) (nl.item(0)); } return root; } }