OK, this doesn't seem possible. I am returned a NodeList which, when explicitly tested to be null, is shown to be not null. Yet as soon as I try to access it, I'm awarded a NullPointerException.
Here's code that illustrates the problem: Element root = doc.getDocumentElement(); // Start by getting the Element of interest NodeList nodes = root.getElementsByTagName(elementName); //System.out.println(nodes); // shows type is DeepNodeListImpl //added test to try to sidestep NullPointerException. // Doesn't see condition as true if (nodes == null) { System.out.println("nodelist null"); return false; } //Hmmm. we passed the is null test, but getLength() will fail // with NullPointerException if this is uncommented //System.out.println(nodes.getLength()); // this try-catch really shouldn't be necessary. // but without it, we abort with NPE on the getLength() test try { if ((nodes == null) || (nodes.getLength() == 0)) { System.out.println("didn't find specified element"); return false; // always a failure } } catch (NullPointerException e) { // We will see this message System.out.println("This is stupid"); return false; } Any clue what's going on here? I have this problem occuring twice in my code - once where I expect the returned list to be empty, but in another case where I think the NodeList should contain one entry. I'm using JAXP 1.2_01; I'm not sure how to map that to a Xerces version number. Mike Yawn --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]