This article mainly introduces the basic introduction of xml and xml tag elements for getting started with php xml operations. The example analyzes the composition, specifications, and usage of XML, for more information about how to get started with xml in php, see the following example. Share it with you for your reference. The specific analysis is as follows:
The following describes how to use an xml instance:
Xiaoqiao
Female
23
Zhou Yu
Male
27
I. xml declaration:
(1) the xml declaration should be placed in the first line of the document;
(2) encoding: the character encoding of a document, such as UTF-8 and gb2312.
(3) standalone: The value is yes or no, which indicates whether the document definition is independent, that is, whether it is associated with other documents. The default value is no.
II. root element
Package in the outermost layer It is the root element. Each xml document must have only one root element.
III. xml elements, tags, and nodes
, , ,All are xml elements, also known as labels or nodes. Of course, the root element is also an element.
If the tag contains no content, as shown in figure Can be abbreviated . Even if it is written When the browser is opened, it is also displayed
4. spaces and line breaks in labels
Labels contain spaces and line breaks. xml documents treat spaces and line breaks as the original content. Therefore, pay special attention to programming.
V. xml label naming rules
(1) case sensitive;
(2) it cannot start with a number or;
(3) it cannot begin with xml, XML, Xml, or other special characters;
(4) it cannot contain spaces;
(5) cannot contain colons.
I hope this article will help you with the XML programming for php operations.
For more information about the basic introduction of xml and the xml tag element in php, see PHP!