What is XML and the XML writing format

Source: Internet
Author: User
Tags opening and closing tags processing instruction

XML English full name Extensiblemarkup Language, translated to Extensible Markup Language. XML technology is published by the organization, and it is recommended to follow the XML1.0 specification published by the organization in 2000.

In the XML language, it allows the user to customize the label. A label is used to describe a piece of data, a label can be divided into start and end tags, between the opening and closing tags, and other tags can be used to describe other data to achieve the description of the data relationship.

V an XML file is divided into the following sections:

n Document Declaration

N Element

N Property

N Comments

N CDATA Zones, special characters

n processing instructions (processinginstruction)

XML Syntax Document declaration

V when writing an XML document, you need to use the document declaration to declare the type of the XML document.

the simplest declarative syntax for V:

<?xmlversion= "1.0"?>

V uses the Encoding property to describe the character encoding of the document:

<?xmlversion= "1.0" encoding= "GB2312"?>

V uses the standalone property to indicate whether the document is independent:

<?xmlversion= "1.0" encoding= "GB2312" standalone= "yes"?>

Element Naming conventions

the V XML element refers to the label that appears in the XML file, a label that is divided into the start and end tags, and a label that has the following forms of writing, such as:

N contains the label body:<a>www.itcast.cn</a>

N:<a/> with no label body

V You can also nest several sub-labels in a label. However, all tags must be properly nested and never allow cross nesting, for example:

<a>welcome to <b>www.it315.org</a></b>

A well-formed XML document must have only one root tag, and the other tag is the descendant tag of the root tag.

V an XML element can contain letters, numbers, and other visible characters, but must adhere to some of the following specifications:

L case-sensitive, such as,<p> and <p> are two different tags.

L cannot start with a number or "_" (underscore).

L cannot start with XML (or XML, or XML, etc.).

L cannot include spaces.

The middle of the name cannot contain a colon (:).

Processing Instructions

V processing instruction, referred to as PI (processinginstruction). The processing instruction is used to direct the parsing engine to parse the XML document content.

V For example, you can use the Xml-stylesheet directive in an XML document to notify the XML parsing engine and apply a CSS file to display the contents of an XML document. <?xml-stylesheettype= "Text/css" href= "1.css"?>

V processing instructions must be "<?" At the beginning, with "?>" as the end, the XML declaration statement is the most common kind of processing instruction.


Related Article

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.