What exactly is the meaning of “node” in Document Object Model (DOM)?

I’ve searched for the definition of a “node” in a programming language and I am still finding it hard to understand.

Could anyone advice me in simple, layman’s terms:

What is a node?

7

Etymologically, a “node” is a “knot”: think of a fisherman’s net as “holes tied together with string”, and then nodes are where the string is knotted. The term comes from graph theory in mathematics. If you think of a graph as a collection of points connected to each other by lines (“arcs”), then the points are called nodes. A tree is a special case of a graph in which a node can only have one “upwards” arc (to its “parent”). The DOM models a document as a tree: documents have a hierarchic structure in which sections contains sections contain sections, and a tree is a graph-theoretic representation of a hierarchy. So the parts of a document – the sections – are represented by nodes in the tree.

In the context of an SGML language where DOM is typically used (i.e. HTML, XML), a node is the smallest piece of text that has semantic meaning. Nodes are arranged in a tree structure, with the document as the root node. Each node can have zero or more children.

There are several types of nodes:

  • Document: this is the root node of the whole document. It represents the root of the SGML tree, one step above the root element (e.g. the <html> tag). This is done so it can contain metadata such as the DOCTYPE.
  • Element: this is a “tag” e.g. <div> or <MyXmlElement>. Elements can have subnodes, including attributes and other elements.
  • Attribute: This is one key/value pair inside an element. For example, the class specifier: <div class="SomeCssClass">
  • CDATA: “loose” text: <div>This CDATA is a child of the div element.</div>

You can safely compare it to a map of a subway system, e.g. the London Underground:

London Underground Map
(http://it.wikipedia.org/wiki/Mappa_della_metropolitana_di_Londra)

A node is a stop, an edge is the connection between stations. That’s about it with general graphs. However, there are special graphs with more, interesting properties, like Trees:

a Tree
(https://hbfs.wordpress.com/2013/05/14/average-node-depth-in-a-full-tree/)

Nodes in a tree are either (a) the root (think <html>) or (b) have exactly one parent. They may also have one or many children nodes, which have them as a parent, so we get exactly one path to the root for every node in the graph.

The DOM is a tree.

The Node object represents a single node in the document tree.

A node can be an element node, an attribute node, a text node, or any other of the node types explained in the Node Types chapter.

enter image description here

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật