What is XML (repost)

xiaoxiao2021-03-06  41

What is XML? ? ? ? Like HTML, Extensible Markup Language is also a marking language. It also depends on the label describing a certain rule and the application processing tool that can read these labels to play its powerful features. This, you can also see a spot from the name of XML.

"About the correct topic of this specification, that is, the correct full name of XML, should be extensible Markup Language, extensible Markup Language is just a spelling error. However, nowading XML is not only correct, but as it is in this specification Same, it is the official name of Extensible Markup Language. This name and shorthand are first proposed by James Clark, and other alternative names also include small standard marking languages ​​MGML (Minimal Generalized Markup Language), small standards Structural MAGMA (Minimal Architecture for Generalized Markup Applications), and Internet Set Structure Language SLIM (Structured Language for Internet Markup).

--EXTENSIBLE MARKUP LANGUAGE (XML) 1.0 Specs, The Annotated Version. "

From the initial naming of XML, it can be seen that the core of XML is in the end of the root or the standard. However, XML This marking language is much more powerful than HTML.

"People" is as named, the powerful function of XML comes from "X". That is, XML is not only a marking language, but also an extensible. XML is not like HTML, providing a set of labels that have been defined in advance, but provides a standard that uses this standard, you can define your own new marking language according to actual needs, and set it for you. Language regulates a set of labels. Accurately, XML is a source label language, which allows you to develop a variety of bursary languages ​​based on the rules it provides. This is also the goal of the XML language setting.

"The development of XML is: XML should be able to use directly on the Internet (* is good as HTML). XML should support a variety of different applications (* Not only include browsing, but also the analysis of the content). XML should Compatible with SGML (* Subrush, we will say that SGML is the direct pioneer of XML). Applications that handle XML files should be easily written (* Graduate studies in the computer department spend two weeks. ). The number of optional characteristics in XML should be minimized, it is best to reduce (* optional characteristics often confused). The XML file should have good readability, and it is more clear (* Don't be like HTML, If you don't make a browser, you should read it is simply a test for your willpower and patience). It should be convenient and fast with XML design. You don't have to go through the cumbersome of the standard. XML design The lack language should be official, simple (otherwise how to write easy to read?). XML file should be easily prepared (think about writing an HTML with "Notepad"). The simpleness of the XML mark is not Important (you don't have to take advantage of your heart to reduce tags). --Extensible Markup Language (XML) 1.0 Specs, The Annotated Version. "Let's consider a very simple example. If we need to define a new marking language called FclML (F_company S Client List Markup Language) - F Company's customer list marking language. This language should define some tags to represent the contactable customers and information about them. This group of labels is very simple, and their advantages are representative of a certain language. Let's recall how this information is indicated in HTML in HTML. Compared with it, the following code is clearly readable:

Zhang 3 - Name> 001 A Company zhang@aaa.com (010) 62345678

No. 1234 No. 1234 Beijing Beijing 100001

Lee 4 002 B Company li@bbb.org (021) 87654321 < / Telephone>

No. 9876 Nanjing Road Shanghai Shanghai 200002

This code is a very simple XML file. It looks very similar to HTML, but careful people will find that the label represents the label is no longer display format, but the language of the customer information data.

In fact, the marking language defined with XML can be divided into two categories depending on the side focus of the marker. A class of becoming a language description, as is the example above. There is also a description of the display method, like the XHTML, SVG, SMIL that has been released now, and we will explain in detail. It is worth mentioning that the description of the display method is not limited to the text description, but also vector graphics, images, sounds. For example, a label such as might ask to bold text when describing text, and increase the volume when describing the sound. However, as we mentioned in the day, it is not enough to set the data. In order to let others understand these data, the standard standards in the marking language need to include:

The syntax of the marking synthesis is in other words. If you want the computer application to read and process this data, it must also know what is a valid grouped (such as tag), how to handle a valid marking . Specifically, how does the Netscape browser know how to display this XML file above? Label What mean? Is it a legitimate label? What should it be in what way? Therefore, our marking language must be able to tell the application's syntax that it uses to handle it.

In XML, the syntax of the marked is described by the file type definition DTD (Document Type Definition). That is, we describe what is a valid label through DTD to further define the structure of the marking language. In a marking language defined with XML, the DTD and data files are partially separated. Chapter III We will discuss the definition method of DTD in detail. Here we give the DTD description on the above example, let everyone seek to be fast:

Fclml.dtd:

Similarly, in addition to defining the syntax of the assigned, we also need to define the specific meaning of the marking. In order to clarify the meaning of each tag, XML uses the style sheet connected to it, and provides an instruction description of how to process the display to the application, such as a browser. The specific format of a style sheet We are in detail in Chapter 4. Now we only need to know that the rules made by the style may be like this:

Whenever you see a tag, display it with a

    tag. Similarly, Converts to a tag. All Tags are converted to the
  • Convert ? Li> tag. All tags are converted to tags. Similarly, converted to the tag. and many more...

    In this case, we use HTML tag features to define our FCLML display format. However, if the XML file is not processed by the browser, it is handled by other applications, and we may adopt other corresponding labels. So, our application handler should integrate the three elements of DTD, style orders, and FCLML file data, and display it according to these data and regulations.

    Seeing this, you may have a long say: Is this not more and more complicated? As long as one html can include data and display methods into in, now we need FCLML files, DTD, style sheets - total three files! This is still not counted, we need a processing tool to combine DTD, style sheet, and FCLML. Don't forget, the browser is just used to handle a specific marking language (such as HTML), not to process all the marking languages. This shows that we must not only combine three files, but also create or purchase a new application handler. so horrible!

    "A software model called an XML processor should be able to read an XML file and explain its content and structure. The xml processor is based on another model called the application. --Extensible Markup Language (XML) 1.0 Specs, The Annotated Version

    Indeed, for beginners, it is indeed to overcome some obstacles when using XML, but in the following section, you will see it, it is very worthwhile.

转载请注明原文地址:https://www.9cbs.com/read-58125.html

New Post(0)