class XMLUtil {

	@Pure
	private static Node getNodeFromPath(Node document, boolean caseSensitive, int idxStart, String... path) {
		assert document != null : AssertMessages.notNullParameter(0);
		if (path != null && (path.length - idxStart) >= 1) {
			final NodeList nodes = document.getChildNodes();
			final int len = nodes.getLength();
			for (int i = 0; i < len; ++i) {
				final Node node = nodes.item(i);
				if (node != null) {
					final String name = node.getNodeName();
					if (name != null
							&& ((caseSensitive && name.equals(path[idxStart]))
									|| (!caseSensitive && name.equalsIgnoreCase(path[idxStart])))) {
						final Node nd = (path.length - idxStart) == 1
								? node : getNodeFromPath(node, caseSensitive, idxStart + 1, path);
						if (nd != null) {
							return nd;
						}
					}
				}
			}
		}
		return null;
	}

	private  XMLUtil();

}