Results 1 to 2 of 2
Thread: Interface Question
- 12-14-2010, 12:03 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 1
- Rep Power
- 0
Interface Question
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?
- 12-14-2010, 04:28 AM #2
Similar Threads
-
Java Native Interface Question
By RichWade in forum Advanced JavaReplies: 20Last Post: 11-29-2010, 06:26 PM -
question on listener interface
By Minu in forum Java ServletReplies: 1Last Post: 01-16-2009, 10:33 AM -
Interface question in java
By tony404 in forum Advanced JavaReplies: 2Last Post: 06-27-2008, 11:47 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks