Understand XML for common data access

Source: Internet
Author: User
Understand how the Extensible Markup Language (XML) helps us implement common data access. XML is a Unicode-based plain text metalanguage, that is, a language used to define a markup language. It is not attached to any programming language, control system or software supply

Understand how the Extensible Markup Language (XML) helps us implement common data access. XML is a Unicode-based plain text metalanguage, that is, a language used to define a markup language. It is not attached to any programming language, control system, or software vendor. XML can provide a visit to various data processing, construction, conversion and query techniques. (This article contains links to English sites .)

Introduction

The expanded Markup Language (XML) originally imagined is used to define a new document pattern for the Web. XML is derived from the general scale Markup Language (SGML). It can be considered as a metalanguage, that is, a language that defines the markup language. Both SGML and XML are based on the text pattern and provide a mechanism for describing the structure of the document by using a tag (the text is enclosed by '<' and '>. Web developers may be aware that XML is similar to HTML because both are derived from SGML.

With the increasing popularity of XML, it is widely recognized that XML not only helps to describe the structure of new documents for the Web, but also describes structured data. The so-called structured data contains the information typically contained in workbooks, program configuration files, and network protocols.

XML is better than the early data pattern, because XML can easily represent the data of table bureaus (such as relational data or workbooks in databases) and semi-structured data (such as Web pages or business documents ). Existing and widely used patterns (such as comma-separated values [CSV] files) can effectively process table registry data, but cannot process semi-structured data well, however, RTF can only be used for semi-structured text documents. Therefore, XML is widely accepted as a common language for information exchange.

Ubiquitous XML

In addition to structured and semi-structured data, XML also has many other features, making it a widely used data presentation pattern. XML is extensible and platform-independent, and supports internationalization due to its full use of Unicode. XML is a text-based structure. Therefore, you can use a text compilation tool to read and compile XML documents as needed.

The scalability of XML is manifested in multiple aspects. First, unlike HTML, XML does not have a fixed vocabulary. Instead, you can use XML to define specific exploitation programs or industry-specific vocabulary. Second, the exploits that process or apply the XML pattern are more "resistant" to XML schema changes than the exploits that apply other patterns, as long as these changes are attached. For example, assume that an application has

Customer-id

Attribute

Element.

Add

Last-purchase-date

Property, and the exploitation program is usually not damaged. This adaptability is rarely seen in other data patterns, which also becomes a clear advantage for the application of XML.

XML is not attached to any programming language, control system, or software vendor. In fact, the application of various programming languages can easily be born or applied to XML. While the flat *** makes XML facilitate mutual control between different programming platforms and control systems.

Many people have realized that the declaration of data as XML has a lot of advantages, which also promotes the extensive use of XML data sources. People are or have already converted information sources such as business documents, databases, and inter-business communications into application XML as a representation. Microsoft products, such as Microsoft Office®Microsoft SQL Server™Both Microsoft. NET Framework and Microsoft. NET Framework enable end users and developers to naturally use documents, network information, and other data as XML or as XML applications.

XML 1.0 syntax

As mentioned above, W3C XML 1.0 recommends that you describe a text-based structure and use HTML-like syntax to describe structured and semi-structured data.

Comparison between XML and HTML

HTML and XML documents are composed of elements, each of which contains a "starting Tag" (for example ), An end mark (for example ), And the information between two tags (the content of the element ). An element can be annotated using properties, which contain metadata about the element and its content.

However, there is a significant difference between HTML and XML, that is, XML is case sensitive, while HTML is case insensitive. That is, in XML, the start tag

And

Is different, while HTML is similar. Another difference between HTML and XML is that XML introduces the concept of "good structure. XML's "good structure" rules eliminate some inherent ambiguity when processing HTML and other markup languages by forcing some rules, if it forces that all attributes must be enclosed in parentheses, all elements must have a pair of start and end tags, or explicitly indicate that they are empty elements. For a brief explanation of the good structure, see section D.2 of the xml faq.

The most obvious difference between HTML and XML is that HTML has pre-defined elements and attributes, and the actions of elements and attributes have been completely specified, while XML is not. On the contrary, document authors can create their own XML vocabulary specific to their exploitation programs or business needs. The existing XML vocabulary is used in many industries and applications, from financial information reporting (XBRL), financial services (FpML) to Web documents (XHTML) and network protocols (SOAP ). Because you do not need to pay attention to the predefined elements and attributes used to specify how to display or display XML documents, therefore, when creating a document, the document author can focus on the semantic information related to its specific title category. The XML vocabulary introduces the difference between content and situation, so that information and content can be reused in a wider range.

XML document analysis

The following example shows an XML document that represents a customer order in the audiovisual store. Please note that this document not only demonstrates rigorous structured data (used to describe the disc information), but also shows semi-structured data (used to clarify the special clarification and comments for specific customers ), the presentation method is very simple.





Dare
Obasanjo

One Microsoft Way
Redmond
WA
98052




16.95
Nelly
Nellyville


17.55
Baby D
Lil Chopper Toy



If customer is not available at the address then attempt
Leave package at one of the following locations listed in order
Which shoshould be attempted first

Next Door
Front Desk
On Doorstep

Note Remember to leave a note detailing where
To pick up the package.


The document starts with an optional XML declaration to specify the XML version to be applied and then the character encoding applied to the document. Next, we will use the XML style sheet processing command to bind a style sheet. The pattern commands of XML documents contained in the style sheet can display XML documents in user exploitation programs (such as Web browsers) in a more lively way. Processing commands are usually used to embed information specific to exploitation programs in XML documents. For example, most of the exploitation programs that process the above documents will neglect the XML style table processing instructions, while the exploitation programs used to display the XML documents (such as Web browsers) will apply the information in the processing instructions, to determine where the style sheet containing the special instructions for displaying the document is located.

Reference content is as follows:

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.