Here we will describe the differences and links between html dom and xml dom. The topic of this article is why developers think that "DOM Level1 Standard Architecture" is crucial, its prominent importance lies in the subtle differences and inner relationships between HTMLDOM and xml dom.
Differences and relationships between html dom and XML DOM
The DOM Level developed by W3C is divided into two modules: Core and HTML. The first major module is the Core. W3C specifications describe the Core in this way: to meet the requirements of software developers and Web script writers, access and manipulate the parsed HTML and XML content contained in product projects.
The second HTML module is described as: The functions of specific elements in HTML, and the HTML document operation mechanism for just-right, easy-to-use, and intrusive tasks.
The above shows the importance of the two. At the same time, the significance of the HTML module is that it solves the problem of backward compatibility, which can provide a suitable solution in today's DOM Level1 compliant browsers.
According to this statement, if you still cannot understand the above essentials, we can think that HTML documents can use CoreAPI and HTMLAPI; XML documents can only use CoreAPI. In other words, CoreAPI is the overlapping part of HTML and XML, while HTMLAPI is the part that cannot be shared. As the name suggests, it is limited to HTML documents. This is a preliminary understanding of Core/HTML.
Understanding DOM Level1 Core
The essence of understanding DOM Level1Core is to regard Core as a Document composed of many node Nodes). That is to say, a large number of entries may exist in this Document structure, each item can be understood as a "Node ". To discuss this structure, we can start with two aspects: 1. Everything is a Node object NodeObject. From a flat perspective, flattenedview is suitable for interfaces under polymorphism ); 2. Each object inherits from the base class node and implements the node interface, which can be understood from the perspective of OO inheritance ). Observe the HTML section:
- viewplaincopytoclipboardprint?
- <dividdivid="myDiv">
- HelloWorld</div>
- <dividdivid="myDiv">HelloWorld</div>
This is a closed div tag. The following content can be analyzed from the DOM Level1 level:
◆ The label div can be used as the "Node object NodeObject flattening angle, as described earlier)", or the Element Object ElementOBject inheritance angle-the element inherits from Node ).
◆ The Node property id can also be used as the "Node OBject NodeObject flattening angle)", or the attribute OBject Attr. OBject Inheritance angle-Attr inherits from Node ).
◆ The text "Helloworld" can also be used as "Node object NodeObject flattening angle)", the character string object CharacterData Object Inheritance angle-CharacterData inherits from Node ), the angle of Text Object Inheritance-Text inherits from CharacterData ).
Simply put, everything in the DOM1Core section is a node, and the node and its interface can be understood from the inheritance perspective on each object ), the node interface can have node attributes and methods. -- This is a prerequisite for our understanding. Then, depending on the specific node type, the interface attributes and methods are different, depending on the DOM's design for the node.