Dahua XML (3) XML syntax

Source: Internet
Author: User
Tags empty end version
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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.