The difference between node and element in xml is: Element is an element, a small-scale definition, and one of the components of the data. It must be a node containing complete information to be an element; while Node is a node. , relative to the TREE data structure, a node is not necessarily an element, and an element must be a node.
The operating environment of this tutorial: windows10 system, xml3.0 version, Dell G3 computer.
The difference between element (Element) and node (Node). Element is a small-scale definition and must be a node containing complete information. is an element, such as
...
. But a node is not necessarily an element, and an element must be a node.What is node:
NODE is relative to the data structure of TREE. TREE is composed of NODE. You can refer to the tree diagram of discrete mathematics for this part.
What is element
ELEMENT is a concept in XML.
The difference between Element and Node. Element is a small-scale definition. It must be a node containing complete information to be an element, such as
.... But a node is not necessarily an element, and an element must be a node.
The reason why I am confused about Element and Node is because I don’t understand the entire structure of xml. The following is a brief overview:
As can be seen from the above picture, a The xml document consists of element nodes, attribute nodes, and text nodes. Bookstore is called a document element or root element and is also an element node.
XML DOM specifies a node like this
Each component in an XML document is a node.
The entire document is a document node, that is, the Document node. In Java, the Document interface is inherited from the Node interface, representing the entire XML document
Each XML tag is an element node, that is, an ELEMENT node. In Java, the Element interface inherits from the Node interface and represents an element in an XML document.
The text contained in the XML element is a text node, that is, a Text node. In java, the Text interface inherits from the CharacterData interface, and CharacterData inherits from the Node interface, representing the text content of Element or Attr
Each XML attribute is an attribute node, that is, an Attr node. In java, the Attr interface inherits from the Node interface. Comments belong to the comment node, that is, the Comment node. In java, the Comment interface inherits from the CharacterData interface, and CharacterData inherits from the Node interface
So in fact, every object in the xml document is a node. Elements must be nodes, but nodes are not necessarily elements.
Recommended learning: "nodejs video tutorial"
The above is the detailed content of What is the difference between node and element in xml. For more information, please follow other related articles on the PHP Chinese website!