Home >Backend Development >XML/RSS Tutorial >XML example tutorial: Detailed explanation of nodeName, nodeValue and nodeType attributes

XML example tutorial: Detailed explanation of nodeName, nodeValue and nodeType attributes

黄舟
黄舟Original
2017-03-11 17:14:112299browse

This article introduces the nodeName, nodeValue and nodeType attributes in detail

nodeName The attribute contains the name of a node.
The nodeName of the element node is the label name
The nodeName of the attribute node is the attribute name
The nodeName of the text node is always #text
The nodeName of the document node is always #document
Comment: nodeName contains The tag name of an XML element is always uppercase
nodeValue
For text nodes, the nodeValue attribute contains the text.
For attribute nodes, the nodeValue attribute contains the attribute value.
The nodeValue property is not available for document nodes and element nodes.
nodeType
The nodeType property returns the type of node.

The most important node types are:
Element type Node type
Element element 1
Attribute attr 2
Text text 3
Comments comments 8
Document 9

The above is the detailed content of XML example tutorial: Detailed explanation of nodeName, nodeValue and nodeType attributes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn