xml| syntax
Three. Syntax of XML
Let's analyze the examples of the students we mentioned earlier.
<?xml version= "1.0" encoding= "GB2312"?>
< students >
< number >001</number >
< name > John </name >
< sex > male </sex >
< age >20</Age >
</Students >
XML declaration (Declaration), with the following statement:
<?xml version= "1.0" encoding= "GB2312"?>
1. declaration Statement <?xml ...? The role of > is to tell the browser or other handler that the document is an XML document.
The version in the declaration statement represents the edition of the XML specification that the document adheres to.
Encoding represents the language encoding used in the document, and this example uses the encoding "GB2312".
2. Note the case distinction
The case sensitivity in HTML is not very sensitive, but XML is very strict in case of capitalization, and if the initial identity is uppercase, the ending identity must also be uppercase.
3. "Finish" all the identification must have a corresponding end of the logo
People familiar with HTML know that there are many end identities in HTML that are similar to <p>,<tr>,<td>, but this is not allowed in XML.
4. The empty id (empty element) must be closed
<br>, etc, how do we deal with it?
XML added/to end NULL ID
< logo/>
< identity Property Name = "Property value"/>
5. Add quotes to attribute values
Attribute values in HTML can be added "", or Not "", and can be added. In XML, however, attribute values must be added "".
6. Logo can not cross < student >
< number >001</number >
< name > John </name >
</Students >
If you write a
< students >
< number >001
< name >
</number >
John </name >
</Students >
is absolutely unacceptable.
Above six points, for people who have written to the HTML, pay more attention to it, do not follow the existing habits to write XML, or you will always be wrong.