Home  >  Article  >  Backend Development  >  Introduction to php operating xml - attribute analysis of xml tags

Introduction to php operating xml - attribute analysis of xml tags

高洛峰
高洛峰Original
2016-12-24 11:11:481372browse

The example in this article describes the attributes of xml tags for getting started with php operating xml. Share it with everyone for your reference. The specific analysis is as follows:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<class>
 <student id="No001" haha="美女">
  <name>小乔</name>
  <sex>女</sex>
  <age>23</age>
 </student>
 <student>
  <name>周瑜</name>
  <sex>男</sex>
  <age>26</age>
 </student>
</class>

How to write attributes, such as id="No001" in the case.

Note:

(1) Attribute values ​​must be separated by single quotes or double quotes;
(2) An xml tag can have multiple attributes;
(3) Attribute values ​​cannot contain and & symbol; if present, a predefined entity reference in xml is used. There are 5:

Introduction to php operating xml - attribute analysis of xml tags

(4) The same attribute name cannot appear in the same tag: if there is already id="No001", there cannot be another id="No002".
(5) Comment method:

I hope this article will be helpful to everyone’s PHP operation XML programming.

For more articles related to the attribute analysis of xml tags for getting started with PHP operation xml, please pay attention to 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
Previous article:php operation xmlNext article:php operation xml