XML Tutorial-writing a structured XML document

Source: Internet
Author: User
Tags closing tag empty
xml| Tutorial An XML document is a structural specification if it conforms to some basic specifications. XML format has a simpler parsing rule than HTML, allowing XML parsers to parse XML data without external description or understanding of the meaning of the data.

Start and end tags must match
XML elements can contain body text and other elements, and the type of document is given in strict specifications in its schema. However, the elements must be tightly nested: Each start tag must have a corresponding closing tag.
Elements cannot overlap

The following example does not conform to the XML syntax.
<title> Evolution of Culture <sub> in Animals
</title> by John T. Bonner </sub>
The following grammatical forms are corrected:
<title> Evolution of Culture
<sub> in Animal </sub>
<author> by John T. Bonner </author>
</title> <br>
XML tags are sensitive to case
Here are the different elements.
<City> <CITY> <city>
Represents an empty element
XML has a shorthand approach to empty elements: a tag that ends with a/> symbol represents an empty element. For example, the following two lines are equivalent:
<title/> <br> <title> </title>
Reserved characters
Some characters are part of the XML syntactic structure. If you want to reference them in XML data, you must replace them with special characters. These characters are listed below.

<
& &
> >
" "
' '
For example, "Melons cost" is "A&p" to be written as "melons cost < $ at" A&p.
Each XML document must have a unique root element
For example, in a weather report, the element <weather-report> represents the unique root element of this XML document.

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.