Introduction to XML: structure and syntax

Source: Internet
Author: User
Tags xml parser
■ Tools used to create XML files
XML files, like HTML files, are actually text files. Obviously, you will immediately understand that the most common tool for creating XML files is "notepad", just like HTML. In addition to Notepad, there are also some more convenient tools, such as XML Notepad, XML Pro, and CLIP! XML Editor, etc. A major feature of these tools is the ability to check whether your created XML file complies with XML specifications. However, these tools are only available in English and must be paid. Of course, you can still use tools such as FrontPage and DreamWeaver, but it is not very convenient to use. With the increasing popularity of XML, I believe that a very useful tool for creating XML files will appear soon.
■ Example of an XML file
Now we can use notepad to create an XML file. First look at an XML file:
Example 1
----------------------
<〈? Xml version = "1.0" encoding = "gb2312 "? > 〉
<References> 〉
<Books> 〉
<Name> XML quick start </name> 〉
<Author> Zhang San </author> 〉
<Price currency unit = "RMB"> 20.00 </price> 〉
</Books> 〉
<Books> 〉
<Name> XML syntax </name> 〉
<〈! -- This book will be published soon --> --〉
<Author> Li Si </author> 〉
<Price currency unit = "RMB"> 18.00 </price> 〉
</Books> 〉
</References> 〉
----------------------
This is a typical XML file. After editing, it is saved as a file suffixed with. xml. This file can be divided into two major parts: the Prolog and the object body. The first line in this file is the preface of the file. This row is an XML file that must be declared and must be located in the first line of the XML file. It mainly tells the XML parser how to work. The version indicates the standard version number used by the XML file, which must be available. The encoding indicates the character type used in the XML file, which can be omitted, when you omit this statement, the subsequent encoding code must be a Unicode encoding code (we recommend that you do not omit it ). In this example, the GB2312 encoding code is used, so the encoding statement cannot be omitted. There are some statement statements in the preface of the file, which we will introduce later.

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.