Document Object Model (DOM) class

xiaoxiao2021-03-06  151

The Document Object Model (DOM) class is a form in the memory of the XML document. The DOM enables you to read, operate, and modify XML documents programmatically. The XMLReader class also reads XML, but it provides non-cached only, read-only access. This means using XMLReader unable to edit attribute values ​​or elements, or cannot insert and remove nodes. Editing is the main function of the DOM. XML data is a common structured method in memory, although actual XML data is stored in linear mode when it is in the file or from another object. The following is XML data.

enter

Carson

31.95

05/01/2001

Mspress

WA

The following figure shows the structure of memory when this XML data is read in the DOM structure.

XML document structure

In the XML document structure, each circle in this figure represents a node (called XMLNode object). The XMLNode object is the basic object in the DOM tree. The XMLDocument class (it extends XMLNode) supports methods for performing operations for the entire document (for example, loading documents to memory or saving XML to file). In addition, XMLDocument provides methods for viewing and operating nodes in the XML document. Both XMLNode and XMLDocument have performance and availability, and have methods and properties for the following operations:

Access and modify a DOM-specific node, such as element nodes, entity reference nodes, and the like. In addition to the information contained in the search node (such as the text in the element node), all nodes are also retrieved.

转载请注明原文地址:https://www.9cbs.com/read-127906.html

New Post(0)