Here you can find the source of getNode(Node root, String nodePath)
static Node getNode(Node root, String nodePath)
//package com.java2s; /**//from ww w . ja v a 2 s . c om * Copyright (c) 2010-2019 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { static Node getNode(Node parent, String[] nodePath, int offset) { if (parent == null) { return null; } if (offset < nodePath.length - 1) { return getNode(((Element) parent).getElementsByTagName(nodePath[offset]).item(0), nodePath, offset + 1); } else { return ((Element) parent).getElementsByTagName(nodePath[offset]).item(0); } } static Node getNode(Node root, String nodePath) { String[] nodePathArr = nodePath.split("/"); return getNode(root, nodePathArr, 0); } }