Different W3C specifications define different sets of "Node" types.
Thus, the DOM spec defines the following types of nodes:
Document
-- Element
(maximum of
one), ProcessingInstruction
,
Comment
, DocumentType
DocumentFragment
-- Element
, ProcessingInstruction
,
Comment
, Text
, CDATASection
, EntityReference
DocumentType
--
no children
EntityReference
-- Element
, ProcessingInstruction
,
Comment
, Text
, CDATASection
, EntityReference
Element
-- Element
, Text
, Comment
, ProcessingInstruction
,
CDATASection
, EntityReference
Attr
-- Text
, EntityReference
ProcessingInstruction
-- no children
Comment
-- no
children
Text
-- no
children
CDATASection
--
no children
Entity
-- Element
, ProcessingInstruction
,
Comment
, Text
, CDATASection
, EntityReference
Notation
-- no
children The XML Infoset (used by XPath) has a smaller set of nodes:
XPath has the following Node types:
The answer to your question "What is the difference between an element and a node" is:
An element is a type of node. Many other types of nodes exist and serve different purposes.