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
<?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
<?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, if you add another root-level element
2.xml elements can be nested in a loop. The parent element contains child elements, and the child element Level elements can contain their own child elements,
For example, format 1: root element
3. Both elements Medium form:
Form 1
Form 2
For example:
<row col1="11" col2="一(一)班" col3="初一" col4="三峡高级中学" col5="20" col6="30" col7="50"/>
The above is the content of xml learning (1) Several file formats of xml. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!