XML Technology Guide (1)

Source: Internet
Author: User
Tags define data structures end version xmlns access
Xml

Summary: This article describes the XML and the various techniques in the XML family. We'll discuss how each of these core technologies is combined into a complete whole as well as some of the things that support XML technology.
 
It seems like things happen every day: more and more developers believe that XML (extensible Markup Language) will fundamentally change our software industry. But if you want to find out from them why or when this is going to happen, you'll see that the explanations they give are filled with abbreviations for a lot of the proper terminology of XML. These things don't really make you understand, and I'm sure you won't be satisfied with explanations like theirs.

In general, the main obstacle that people encounter when learning to master XML comes from the astonishing speed of XML development. If you look at the Web site on XML (http://www.w4.org/xml/), you'll find a lot of technology and related publications about XML. The consortium has brought such a large amount of information together, creating a lot of trouble for developers. It is more difficult to learn XML when the critical question of how the technologies covered by XML is integrated is not clear.

This article introduces you to the various technologies in the XML and XML family so that you understand not only the importance of XML at a higher level, but also how the various technologies in XML are grouped together into a complete technology. After reading this article, you will have a general idea of the XML-specific nouns and abbreviations that plague you, laying the groundwork for future learning of XML from a deeper level.

So, what exactly is XML?

In many of the authors of previous XML, answering this question has become a fad. As you have already known, XML is the official abbreviation for Extensible Markup language. They may think that the pronunciation of XML is more sexy than eml read, and replaced the original letter E with the letter x. However, when you cross the abbreviation to understand XML from a deeper level, you will find that it is not just a markup language, but a series of techniques. This technology family provides a solution for us to develop software with better scalability and interoperability.

Where does the XML come from?

XML originates from SGML (Standard generalized Markup Language. In other words, you can use both XML and SGML to create your own descriptive document. Both languages use text identifiers (Tags) to describe the data for use by other applications or tools (such as an SGML or XML analyzer). With XML, they can read the information correctly and do some interesting things with the data. XML is a simplified version of SGML and is more suitable for use on the web.

Syntax FOR XML

XML defines the syntax used to describe your data. It's a correct XML statement:


Unlike other identity languages, XML is sensitive to capitalization. So,
If an XML document contains only one root element, and all child elements are correctly placed in the parent element, such XML has a good style. More specifically, for each given child element, its begin and end tags exist only in the same parent element. Here is a good example of an XML document (Hamburger.xml).

<?xml version= "1.0"?>
<name>CowBurger</name>
<description>greasy and Good.</description>
<price>2.99</price>


Who will define tags?

After reading the previous section, you will find that you have a basic understanding of the syntax of XML. In fact, this is not a lot of content, XML is really very simple.

As you may have noticed, XML looks much like HTML (Hypertext Markup Language). They all use the same syntax to define begin and end tag and some properties. In essence, HTML uses some predefined elements and methods, just a special case of XML. These elements and their associated methods determine how the browser interprets an XML document and then provides it to the end user.

and HTML provides a common way to create a user interface, XML provides a common way to describe and collaborate on data work. XML allows developers to create their own XML vocabulary and describe their own data structures in a customized way. If a developer is developing software for a fast-food chain, a "hamburger" element can be very handy to describe some food.

Once developers have used XML to describe their data, they can easily interoperate with the same or different systems. Of course, the premise is that those systems can understand XML. For example, a developer can use data from another system, as long as the data is described in XML. In this way, developers will no longer have to worry about the different aspects of the platform, operating system, language, or data storage, when considering the interoperability of the software. XML is the simplest tool for implementing interoperability between systems.

namespace of XML

Because of XML's support for interoperability, everyone can create their own XML vocabulary. As a result, if different developers use the same elements to represent different entities, the consequences would be unthinkable. To prevent this potential conflict, the consortium introduced namespaces in XML.

XML namespaces provide a context for your XML document elements. It allows developers to process elements in a certain semantics. Also as an example of hamburgers, in a system, price element may represent the consumer's purchase prices, and in another system, it may represent the store's purchase price. The following example shows how namespaces can help us solve such problems.

<?xml version= "1.0"?>
Xmlns:purchase= "Http://fastfood.org/franchise/prices"
Xmlns:sales= "Http://fastfood.org/customer/prices"
>
<name>CowBurger</name>
<description>greasy and Good.</description>
<purchase:price>0.99</price>
<sales:price>2.99</price>


How do I use XML?

The syntax of XML is not difficult, but it is challenging to use XML so that it can help us do something.

To use XML well, we need to be able to process XML files programmatically. The consortium defines a software model called an "XML processor." It is able to read XML documents and provide access to their content and structure. Microsoft's main XML processor is called Microsoft XML (MSXML) 2.0. MSXML 2.0 is bundled with IE 5.0 and can be obtained free of charge as a separate distributable file from the Microsoft MSDN XML Web site (http://msdn.microsoft.com/xml).

One of the main advantages of using XML as a common standard for describing data is that any XML processor provides the functionality that enables us to achieve the goals we think of. Developers hardly need to write their own XML processors (if you've ever done so). In theory, developers should use the best processors on the market to avoid compatibility problems.

With a standard XML processor, you can programmatically read various XML documents (such as hamburger.xml) to access any element, element content, or element attribute. If you create an XML document in a windows-based system, you can easily transfer the document to a mainframe system, using a mainframe XML processor to interact with the same data. That's where the real glamour of XML is. As a technology, XML does not solve all the problems of your software, but it has become an open and efficient mechanism for exchanging structured data between you and other people's applications.

Core technology of XML

Up until now, you have been able to create your own XML document with complete creation. However, the real potential of XML lies in the many technologies it supports. You do not have to use all the techniques discussed below for this purpose. But their presence can help you understand how these technologies are grouped together as part of an entire XML strategy.

Validation technology

You already know that. XML provides a complete set of flexible syntax for describing well-formed documents. Because of this flexibility, we need some way to confirm that a particular category of XML document has a format that we anticipate. For example, the following is a well-formed XML document:

<?xml version= "1.0"?>
<name>CowBurger</name>
<description>greasy and Good.</description>
<price>2.99</price>
<price>3.99</price>


However, there are some application-level issues with this document. Notice that a hamburger element in the document appears inside another hamburger element. Don't worry, for this example, there is no error in this XML structure. Also, note that there are multiple price elements in the hamburger element in the layer. Which Price is the right one? It is possible that the system will show a bug here. In this case, a standard mechanism for confirming XML documents will be useful.



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.