What is XML?

Source: Internet
Author: User
Tags cdata closing tag comments processing instruction xml parser
What is XML?
XML is the abbreviation for Extensible Markup language
XML is a markup language similar to HTML
XML is used to describe the data
The markup for XML is not predefined in XML, you must define your own markup
XML uses document type definition (DTD) or schema (schema) to describe data
XML is a self-describing language after using a DTD or schema
--------------------------------------------------------------------------------
What are the main differences between XML and HTML?
XML is used for storing data.
XML is not an alternative to HTML, and XML and HTML are two different uses of languages.
XML is designed to describe data, focusing on what is data and how data is stored.
HTML is designed to display data, focusing on how to display data and how to display it better.
HTML is associated with displaying information, and XML is related to descriptive information.
--------------------------------------------------------------------------------
XML doesn't do anything.
XML is designed to do nothing.
It may seem hard to understand, but in fact XML does nothing. XML is only used to organize, store, and send information.
The following example is a note ordm to Lin, using the XML format:
<note>
<to>Lin</to>
<from>Ordm</from>
<body>don ' t forget me this weekend!</body>
</note>
This note has a message header, a message body, and a sender and receiver. However, the XML document still does nothing, and he only uses XML tags to store the information in the file. Someone has written out the software that sends and receives and displays this format information.
--------------------------------------------------------------------------------
XML is free and extensible
XML tags are not predetermined, you have to create your own tags.
In an HTML document, you must use a tag that is defined in the rule. Like:<p><br><a></a> and so on.
XML allows you to define your own markup and document structure.
For example, the "<to>" and "<from>" tags in the above example are not defined in advance in the XML specification. These tags are "created" by the author of the XML document.
--------------------------------------------------------------------------------
XML is supplemental to HTML
XML is not an alternative to HTML.
It is important to understand that XML is not an alternative to HTML. In future Web page development, XML will be used to describe and store data, while HTML is used to format and display data.
The best description of XML might be that XML is a cross-platform, software-and hardware-independent tool for processing information.
--------------------------------------------------------------------------------
Application of XML in future web development
XML is Everywhere
It is surprising that XML has developed very quickly, with many software developers adopting XML standards.

We believe that in future web development, XML will be as important as HTML, they are the foundation of web technology. XML will become the most common tool for data manipulation and transmission

XML is the abbreviation for Extensible Markup Language。 Extensible Markup Language XML is a simple data storage language that uses a series of simple tags to describe data that can be built in a convenient way, although XML takes up more space than binary data, but XML is extremely simple and easy to master and use.

Unlike databases such as access,oracle and SQL Server, the database provides more robust data storage and analysis capabilities, such as data indexing, sorting, lookup, correlation consistency, and so on, and XML is just presenting data. In fact, the biggest difference between XML and other data forms is that he is extremely simple. This is an advantage that looks trivial, but it makes XML unique.

The simplicity of XML makes it easy to read and write data in any application. This makes XML quickly the only common language for data exchange, although different applications support other data interchange formats, but they will soon support XML, which means that programs can be easier to connect with Windows, Mac OS, The combination of Linux and the information generated under other platforms can then easily load XML data into the program and analyze it and output the results in XML format.

The predecessor of XML was SGML (the Standard generalized Markup Language), a GML that began to evolve since IBM in the 60 (generalized Markup)

Like HTML, XML (extensible Identity language) is a subset of the Universal Identity Language Standard (SGML), which is a standard for describing the content and structure of data on a network. However, unlike Html,html, which provides only a common way to display information on a page (without context-related and dynamic functionality), XML gives context-related functionality to the data, inherits most of SGML's functionality, and uses less complex techniques.

To make SGML look user-friendly, XML redefined some of the internal values and parameters of SGML, removing a large number of infrequently used features that make SGML more complicated in designing websites. XML retains SGML's structured functionality, which allows web designers to define their own document types, and XML also introduces a new type of document that allows developers to avoid having to define document types.

Because XML is created by the wide-area business, the standardization of XML is handled by the XML workgroup of the Consortium, which consists of experts from various places and industries who communicate their views on XML standards via email and make their own comments (Www.w3.org/TR/WD-xml). Because XML is a public format (it doesn't belong to any company), you don't have to worry that XML technology will be a profitable tool for a handful of companies, and that XML is not a language attached to a particular browser

XML (Extensible Markup Language) derives from an older language called SGML (Standard Universal Markup Language). The primary purpose of SGML is to define the syntax of a markup language that uses labels to represent data.

The label consists of a text surrounded by a less than sign (<) and a greater-than (>) number, such as <tag>. The start tag (start tag) represents the beginning of a particular area, for example, the <start>; end tag defines the end of an area, except that it follows a slash (/) after the less than sign, as in the case of the start tag, such as </end>. SGML also defines the attributes of labels, which are defined as values between less than and greater than numbers, such as the SRC attribute in the . If you think it looks familiar, you should know that the most famous implementation of SGML based languages is the original HTML.

SGML is commonly used to define document type definitions (DTDs) for HTML, and it is often used to write XML DTDs. The problem with SGML is that it allows for some strange syntax, which makes the parser that creates HTML a big challenge:

1 Some start tags do not allow the end tag to appear, such as HTML tags. An error occurs when a closing tag is included.

2 Some start tags can selectively end tags or implicitly end tags, such as HTML <p> tags, and when another <p> tag or some other tag is present, assume that there is an end tag before that.

3 Some start tag requirements must appear in the end tag, such as HTML <script> tags.

4 tags can be nested in any order. This is permissible even if the end tag does not appear in reverse order of the start tag, for example, the <b>this is a <i> sample </b> string</i> are correct.

5 Some attribute requirements must include values, such as the SRC attribute in the .

6 Some features do not require a value, such as the nowrap attribute in <td nowrap>.

7 It is OK to define both sides of the attribute with double quotes, so and are allowed.

These problems make it a daunting task to create a parser for the SGML language. The difficulty of deciding when to apply the above rules has resulted in the definition of SGML language stagnating. With these questions as a starting point, XML is gradually entering our field of vision.

XML removes the arbitrary syntax of SGML, which has previously bothered many developers. In XML, the following syntax is used:

8 Any start tag must have an end tag.

9 You can use another simplified syntax to represent both the start and end tags in a single label. This syntax is followed by a slash (/), such as <tag/>, before the symbol is greater than the sign. The XML parser translates it into <tag></tag>.

10 tags must be nested in the appropriate order, so the end tag must match the starting tag in the mirror order, such as <b>this is a <i>sample</i> string</b>. This is like starting and ending labels as the left and right brackets in math: You can't close parentheses without closing all the inner brackets.

11 All attributes must have a value.

12 All attributes must be enclosed with double quotes around the value.

These rules make it much simpler to develop an XML parser and remove the task of parsing SGML to determine when and where to apply those strange grammatical rules. In the first six years after the advent of XML, many different languages were spawned, including MathML, SVG, RDF, RSS, SOAP, XSLT, and XSL-FO, while also improving HTML to XHTML.

If you need a specific technical comparison of SGML and XML, check out the notes for the world of Http://www.w3, located at: Org/tr/note-sgml-xml.html

Today, XML is one of the fastest growing technologies in the world. Its main purpose is to use text to represent data in a structured way. In some ways, XML files are similar to databases, providing a structured view of the data. Here is an example of an XML file:


Each XML document starts with an XML preamble, and the first line in the preceding code is the XML preamble, <?xml version= "1.0"?>. This line of code tells the parser and the browser that the file should be parsed according to the XML rules discussed earlier. The second line of code, &LT;BOOKS&GT, is the document element, which is the outermost label in the file (we think the element is the content between the start and end tags). All other tags must be included within this tag to form a valid XML file. The second line of the XML file does not necessarily contain the document element, and if there are comments or other content, the document elements can appear later.

The third line of code in the sample file is a comment, and you will find that it is the same as the annotation style used in HTML. This is one of the syntax elements that XML inherits from SGML.

The page goes down some places, you can find that <desc> tags have some special syntax. <! [cdata[]]> code is used to represent text that does not need to be parsed, allowing special characters such as the greater-than and less-than numbers to be included in the text without worrying about breaking the syntax of the XML. Text must appear in <! [cdata[and]]> can properly avoid being parsed. Such texts are called character Data section, or CDATA section.

The following line is before the definition of the second book:

<?page Render Multiple authors?>

Although it looks much like an XML preamble, it is actually a different type of syntax called a processing instruction (processing instruction). The purpose of the processing instruction (PI) is to provide additional information to the program that processes the page, such as the XML parser. Pi is usually not a fixed format, the only requirement is to follow the first question mark must have at least one letter. After that, pi can contain any sequence of strings except for the less-than and greater-than numbers.

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.