Académique Documents
Professionnel Documents
Culture Documents
If you are going to use the DOM in the standard Java library you should get really familiar with
the table in the Javadocs for the Node interface in the org.w3c.dom package. There are 12
different subinterfaces of Node - each with its own peculiarities summarized in that table.
• root nodes
• element nodes
• text nodes
• attribute nodes
• namespace nodes
• processing instruction nodes
• comment nodes
The answer to your question "What is the difference between an element and a node" is:
exmaple
Element:
<name>Hari</name>
Node:
<name id="1212" dep="6">Hari</name>
What is the difference between XML Attributes and XML
Elements?
Both elements and attributes have been designed to have a Name and a Value.
Elements can be parents of other elements and/or attributes and can be repeated within the
same level of an XML document. They also usually have start and end tags.
An element would look like: <Customer>John Doe</Customer>
When to use Elements versus Attributes is a very polemic question and more related to
architectural considerations than technical details.
Elements can occur more than once (repeating) within the same level, while attributes can only
appear once within the same level, example:
It is okay to have:
<Root>
<Customer ID="1234">John Doe</Customer>
<Customer ID="2345">Jane Doe</Customer>
</Root>
Elements can be defined to be in a certain order, while attributes can appear in any order.
If you would like to get some extra details on this matter, please see visit one of the following
web-pages:
http://www.itworld.com/nl/xml_prac/12132001/
http://xml.coverpages.org/elementsAndAttrs.html