Hi:
I realised that XMLElement does not the getNodeValue() methods, so this is the corrected version.
I have included the computation of the namespace resolver too but I get a
Java NPE at node.getAttribute()? Can someone tell me why?
I tried the following but I am getting NPE at node.getAttribute(), can you tell me whether my namespace resolver is being computed incorrectly?--
public void doCombine() throws FileNotFoundException, IOException, XSLException, InvocationTargetException, XMLParseException,
SAXException
{
URL in_xml_url = new URL("file://" + getSpec());
XMLDocument xmlDocument = null;
//Create a parser
DOMParser parser = new DOMParser();
parser.setValidationMode(XMLConstants.NONVALIDATING);
parser.setBaseURL(in_xml_url);
//Create a document from the url
parser.parse(in_xml_url);
//Cache the document from the parser
xmlDocument = parser.getDocument();
XMLElement nsr = (XMLElement) xmlDocument.getDocumentElement();
NodeList nodeList=xmlDocument.selectNodes("/applet/transport/@name", nsr);
XMLElement node=(XMLElement)nodeList.item(0);
String trans_val1 = node.getAttribute("name"); //get NPE here
XMLElement node1=(XMLElement)nodeList.item(1);
String trans_val2 = node1.getAttribute("name");
}