I am trying to create my own custom Node class. I am implementing the Node class and that seems to be working fine. I now need to use the NodeList class. I am grabbing the first element from the NodeList class and I need to somehow cast it to my CustomNode class...
String responseString; //a string of XML
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(responseString))); //convert to a DOM document
NodeList selected = document.getDocumentElement().getElementsByTagName (element); //Select the correct node
CustomNode selectedNode = selected.item(0);//ERROR here selected.item(0) returns a node and I am trying to use a class that implements the Node interface.
What am I doing wrong?
CustomNode selectedNode =[COLOR="Red"] (CustomNode) [/COLOR]selected.item(0);