The example in this article describes the cdata section of 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="No<001" haha="美女"> <name>小乔</name> <sex>女</sex> <age>23</age> <info> <![CDATA[ 内容部分&*&$#^@*(#))$#*%# ]]></info> </student> <student> <name>周瑜</name> <sex>男</sex> <age>26</age> </student> </class>
Knowledge points:
(1) The text in the xml document will be parsed by the xml parser, but the content in the cdata section will not be parsed. Therefore, cdata can contain some special characters, such as &, <, etc.
(2) The cdata section starts with .
Corresponding to CDATA is PCDATA: PCDATA represents the text to be parsed, and constraints are defined in DTD.
I hope what is described in this article will be helpful to everyone’s php operation XML programming.
For more related articles on the cdata section of getting started with php operation xml, please pay attention to the PHP Chinese website!