1. XML introduction
XML represents an extendable marker language defined by the XML working group of the Global Information Network Association (W3C). The team describes the XML as follows: "Extensible Markup Language; XML) is a subset of SGML ... The goal is to allow general SGMLs to be served, received and processed on the website. Like Like HTML, XML is designed to be easy to do, and can cooperate with SGML and HTML. "This introduction is extracted from the official XML specification 1.0 version, which is the XML working group in February 1998. carry out. You can read the entire file from http://www.w3.org/tr/rec-xml W3C.
2. XML solution
The definition part of the XML solution XML is composed of the basic syntax. When you build an XML file, you can build your own elements and name any of your favorite names, rather than only those predefined elements groups that are restricted, thus reaching the extendable volume language "Extensible" characteristics. So you can almost use XML to describe all forms of files, from the music score to the database. For example, you can describe a list of books, as shown in the XML file below. XML Version = "1.0"?>
The structure of this example XML file can be drawn as follows: so you can quickly use XML to define class structured files, such as books, chapters, sections, and different levels of sections, as mentioned above.
3. XML's official goal
The official target of XML next describes the ten design objectives of the XML elaborated in the official XML specification in the W3C website (http://www.w3.org/tr/rec-xml): 1. XML Should be used directly on the Internet. As you have seen in this chapter, XML is mainly designed to store and transfer information on the website. 2. XML should support a variety of different applications. Although the primary purpose of XML is to transmit information through the server and browser program on the website, XML is also designed to use software for other types. For example, XML has been used to inter-financial information, distribute and update software, and is used to write sound script so that you can transfer through telephone. 3. XML should be compatible with SGML. As explained before, XML is a set of special uses of SGML. The advantage of this feature is that the SGML software tool can easily join and XML work together. 4. You should easily write a program that processes the XML file. If XML is able to be able to be widely implemented, the browser and other programs responsible for processing XML files should be easily written. In fact, the main reason for the XML subset of SGML is to write inconvenience to handle SGML file programs. The design objectives mentioned later are mainly to support this fundamental target. 5. The number of selective functions in XML should be maintained at minimum, and ideal is zero. Use the minimum number of selective features in XML to make developers to write programs to process XML files easier. A rich selectivity in SGML is the main factor of SGML is considered to be unable to define a website file. These selective SGML features include redefining the qualified characters in the volume marking (generally "<" and ">") and when the handler can indicate that the element is ended there, the end tag can be omitted. A full application for handling SGML file features, must be responsible for all selective features, even those that are not commonly used. 6. The XML file should be readily read and clearly clear. XML is designed to become a general medium for the world's users and applications. Easy-read features make people and certain software programs to read and read XML files. The readability of XML will distinguish XML from most proprietary formats used for databases and text processing files. Because the XML file is written in pure text and has a logical tree structure, people can easily read the XML file. You can choose meaningful names for your file, attribute and entity, and add useful annotations to enhance the readability of XML. (The author will explain elements, attributes, entities and annotations in the later chapters.) 7. The design of XML should be fully prepared. Of course, XML can only be able to implement it in the case where the programming staff is willing to accept it. Therefore, the standard must be completed before the ethnic group begins to accept other alternative standards, as software companies can certainly hope to quickly produce finished products. 8. The design of XML should be in format and concise. The XML specification is used to define a regular language written in a computer language, generally referred to as an Extended Backus-Naur Form (EBNF) tab. This formal language, although it is sometimes difficult to read, but it solves the problem of unclear meaning, and finally makes the XML file with (especially) XML processing software easier, which in turn promotes the possibility of XML acceptance. . 9. XML files should be easily established. In order to make XML become a label language actually applied by the website file, not just XML handlers must be easily written, and the XML file itself must be easily established. 10. Simplify the XML tag is the least important.
In order to match the target 6 (the XML file should be easy to read and reasonable), the XML tag must not be too simple to be too simple to read. 4. Some basic rules of XML
The file must be strictly limited to only one top element (file elements or root elements). All other elements must be set under this element. Elements must be suitably set. That is, if the element begins in another element, it must end in the same element. Each element must have a starting element and an end element. Unlike HTML, XML does not allow you to omit the end tag - even if the browser can determine where the element ends. (However, in Chapter 3, you will learn a simple volume to use blank elements - ie elements with no content.) In the starting tab, the name of the element form must be fully compliant in the corresponding end tag. name. The name of the element type is case sensitive. In fact, all the words in the XML volume label are case-sensitive. For example, the following element is not identical because the type name in the starting tab is different from the type name in the end of the label, so it is not legal.
5. A simple example of XML Sample.xml
XML Version = "1.0"?>
Application display XML file using a series table
First build Sample.Css file book {display: block; margin-top: 12pt; font-size: 10pt} title {font-style: itAlic} author {font-weight: bold}
Then add XML-Stylesheet Type = "TEXT / CSS" href = "inventory01.css"?> "