当前位置:网站首页>DOM Brief

DOM Brief

2022-07-06 18:25:00 Full stack programmer webmaster

Hello everyone , I meet you again , I'm the king of the whole stack .

Looking at Js I feel like when I watch the video Dom It's amazing . In this user experience oriented Web In the age of design .Dom Is crucial .

It's easy to use . And traversal is simple . Support XPath.

Since it is so powerful, let's give a brief introduction Dom This east east .

One 、DOM What is it? ?

DOM namely : Document object model (DocumentObject Model).DOM It's a programming interface . Is aimed at HTML file 、XML And other documents API. Is similar to the JDBC It is a set for database API equally .

Two 、DOM What for? ?

DOM It is used to access or operate HTML file 、XHTML file 、XML Node elements in the document .

Now almost all browsers are running W3C released DOM standard , So you can use it on the browser DOM Of these API.

3、 ... and 、 When to use ?

DOM In fact, it is a programming that operates the contents contained in the document API, Developers use it to read from documents 、 Search for 、 changes 、 Add and delete data .

Four 、DOM Specify

HTML The document is a tree structure , Root is <HTML>;DOM It's also a tree structure , Root is window or document object . therefore DOM You can put HTML In the form of a tree .

5、 ... and 、DOM The classification of

The core DOM: Defines a set of standard objects that can be targeted at any document .

HTML DOM: in the light of HTML Document DOM.

XML DOM: in the light of XML Document DOM.

6、 ... and 、DOM The level of Level

DOM0: No W3C standard .

DOM1: At first it was W3C standard . Focus on HTML Documentation and XML file .

DOM2: Yes DOM1 Added style sheet object model

DOM3: Yes DOM2 Added content model (DTD 、Schemas) And document validation .

7、 ... and 、DOM Advantages and disadvantages

DOM The advantages of : Easy to use , Use DOM when , Will put all XML Document information is stored in memory . And traversal is simple , Support XPath. Enhanced ease of use .

DOM The shortcomings of : Low efficiency , Parsing speed is slow , Memory usage is too high , For large files, it is almost impossible to use . In addition, low efficiency also shows that nowadays a lot of time is consumed , Due to the use DOM When parsing , Will be for each of the documents element、attribute、processing-instrUCtion and comment Create an object , In this way DOM The creation and destruction of a large number of objects used in the mechanism will undoubtedly affect its efficiency .

summary :

The above is only true DOM The accumulation of basic knowledge , Let it have a clue in its own mind . As for how it is implemented in code , It will be added slowly in the future study .

Copyright notice : This article is an original blog article , Blog , Without consent , Shall not be reproduced .

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117406.html Link to the original text :https://javaforall.cn

原网站

版权声明
本文为[Full stack programmer webmaster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061018310547.html