aspose file tools
The moose likes XML and Related Technologies and the fly likes need advice on Element and Node Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "need advice on Element and Node" Watch "need advice on Element and Node" New topic
Author

need advice on Element and Node

Norazanita Adnan
Ranch Hand

Joined: May 28, 2008
Posts: 44
hi..
is there anything wrong with this code?



im confuse here
--> is a Element
but i the function can receive in as an element, i need receive as an node type.

can i declare

I know element is the subinterface of node but i dont get get what is the diff when i declare "Element root" instated of "Node root"

Hope someone able to advice me on this.

thanks in advance.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

It's just basic polymorphism. An Element "IS A" Node, because Element is a subinterface of Node. That means that Element has all the methods that Node does. It also means that Element could have some other methods that Node doesn't have, and in fact it does. It has methods allowing you to access the attributes of the element. Those methods aren't in the Node interface because not all types of nodes have attributes.
Norazanita Adnan
Ranch Hand

Joined: May 28, 2008
Posts: 44
thanks..so meaning now it find i declare as Element and send as and Node type..thanks..no i start to like programming....
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: need advice on Element and Node
 
Similar Threads
xml JAVA
RefList help
A challenge
a simple problom
a simple but complex problom