HTML DOM, DOM Tree and Web Browser Environment

Leave a Comment

The Document Object Modeling (DOM) is for defining the standard for accessing and manipulating XHTML, XML and other scripting languages. It is the W3C recommendation for handling structured documents. Normally the structured information is provided in XML, HTML and many other documents. Hence DOM provides the standard set of programming interface for working with XML and XHTML and JavaScript.

What is DOM?

Document Object Model (DOM) is a set of platform independent and language neutral application programming interface (API) which describes how to access and manipulate the information stored in XML, XHTML and JavaScript documents.


DOM Tree

The documents in DOM are represented using atree like structure in which every element is represented as a node. Hence the tree structure is also referred as DOM tree.

For example consider follwing XHTML document.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This  is my Web Page</title>
</head>
<html>
<body>
<h1>Hello Friend</h1>
<h2>How are you?</h2>
<h3>See you</h3>
</body>
</html>
</html>

The DOM tree will be


We can describe some basic  terminologies used in DOM tree as follows -

  1. Every element in the DOM tree is called node.
  2. The topmost single node in the DOM tree is called the root.
  3. Every child node must have a parent node.
  4. The bottommost nodes that have no children are called leaf nodes.
  5. The nodes that have the common parent are called siblings.

0 comments:

Post a Comment