Dom Basics and DOM manipulation html

Source: Internet
Author: User
Tags xpath




File object Model DOM ) is a Standard programming interface recommended by the Organization for the processing of extensible flag languages. the DOM can access and modify the content and structure of a document in a platform-independent and language way. In other words, this is a common way of representing and working with an HTML or XML document. using the DOM allows us to use HTML and XML data in AJAX to DOM mode of operation, so that the dynamic modification of the page updates and data extraction processing.

Simple company of the DOM:

in the JAvaScript there is a special object in the Document , which can represent the current HTML the root node of the page. DOM will each HTML or XML Documents are treated as an object tree in memory:

in the DOM tree, the document content corresponds and many different types of nodes, are a node object.



for DOM can be viewed using the DOM of the API .


Use:

using server-side return XML data, and then use the HttpRequest objects, and Response accept it as a DOM object to be processed, there are two other ways of getting XML the data.


in the JAvaScript Loading in XML There are two ways in which a document ① load the same domain XML documentation. ② loads a string representing XML.



can take advantage Domapi for XML (in some ways XML is used to store data, which allows the user to customize markup in XML) the operation.

DOM serialization of objects becomes XML string. is to speak the XML file content of all parties as a string.


this is to put a XML The document is exported as a string.


The production of XPath technology:

because of the use getElementById or Get Elementbytagname not so sure. XML the node



so the XPath technology. the dom4j Open source package in Java has selectsingnode and selectnodes These two methods can be based on a XPATH expression to get one or more nodes.


JAvaScript High-level knowledge in the lecture

arrays, the creation of simple objects, JSON data format, object-oriented JAvaScript Classes define the definition of public properties and methods, as well as the definition of private properties and methods, the definition of static properties and methods, the simulation interface, and the class implementation interface. These have been made in detailed notes.



Use DOM Mind to manipulate the document, think of it in your mind.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Dom Basics and DOM manipulation html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.