* contextNode is searched for a child named path[0],
* this node is searched for a child named path[1]...
*/
public static NodeList getNodeListFromPath(Node contextNode,
String[] path) {
if (contextNode == null) return new NodeListImpl();
if (path == null || path.length == 0) {
return new NodeListImpl(new Node[] {contextNode});
}
NodeListImpl result = new NodeListImpl();
try {
getNodesFromPath(result, contextNode, path, 0);
} catch (NullPointerException npe) {
// this NPE is thrown because the parser is not configured
// to use DOM Level 2