Home >Backend Development >XML/RSS Tutorial >Understand several file formats of xml
[Introduction] 1 Let’s briefly introduce XML. XML is a text-based markup language, similar to HTML, which can easily store data. 2. Several formats of XML files: Format 1: View an XML CD directory [ html]view plaincopy
1. Let’s briefly introduce XML. XML is a text-based markup language, similar to HTML, which can be convenient. Storing data
2. Several formats of XML files:
Format 1: View an XML CD directory
[html] view plaincopy
<?xml version="1.0" encoding="utf-8" ?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> </CATALOG>
Format 2: View an XML school grade directory
[html] view plaincopy
<?xml version="1.0" encoding="utf-8" ?> <config> <Header col1="班级编号" col2="班级名称" col3="年级" col4="学校" col5="男生" col6="女生" col7="人数"/> <row col1="11" col2="一(一)班" col3="初一" col4="三峡高级中学" col5="20" col6="30" col7="50"/> <row col1="12" col2="一(二)班" col3="初一" col4="三峡高级中学" col5="18" col6="12" col7="30"/> <row col1="13" col2="一(三)班" col3="初一" col4="三峡高级中学" col5="16" col6="26" col7="42"/> <row col1="14" col2="一(四)班" col3="初一" col4="三峡高级中学" col5="23" col6="17" col7="40"/> </config>
3, Analysis:
1.xml can only have one root-level element, and cannot have multiple root-level elements. For example, add it in format 2 A root-level element
2.xml elements can be nested cyclically. The parent element contains child elements, and the child elements can contain their own children. Level elements,
For example, format 1: the root-level element
3. Two forms of elements:
Form 1
Form 2
For example:
The above is the detailed content of Understand several file formats of xml. For more information, please follow other related articles on the PHP Chinese website!