Why should we learn XML? (Http://bbs.dvbbs.net/dispbbs.asp? Boardid = 1 & id = 820814)

Source: Internet
Author: User
 [Share] Why should we learn XML?

I have been learning XML these two days. Some of my friends are also interested, but I don't know what XML is. I want to transfer some materials and hope more friends can join me, let's study these technologies together.

Look at the number of people you are interested in. I will post it! Let's work together!

<! -- Body content -->

1.2.1 starting from HTML

Most Web page makers may still have a liking for HTML. I heard that a new language is required to replace it, And I instinctively want to defend two sentences for old friends first. What about html? Isn't it good?

Good. Speaking of the booming Internet in today's world, HTML has indeed made great strides. However, the characteristics of HTML have hidden many crises. As it continues to develop, these crises have not only not weakened, but have become more and more prominent, and have even become an obstacle for the continued development and application of HTML. Even the long-standing reputation of HTML over the past few years cannot conceal its ever-increasing profound crisis.

At the beginning, HTML was designed to mark them based on the meaning of the information, without specifying how they should be displayed in the browser. Recall that in earlier versions of HTML, <title> indicates the title,

Unfortunately, browser developers do not know much about the preferences of these special users. Instead, they introduce some defined labels and attributes and use these new labels to specifically describe the display format, such as labels <font>, <center>, and <bgcolor>. Browser vendors have also developed their own web page creation software, such as Netscape composer developed by Netscape and FrontPage developed by Microsoft. These WYSIWYG web page creation tools automatically generate HTML files, which ignore the semantic information of tags and use them almost completely as the format expression tools. For example, the current table labels, such as <Table>, <tr>, and <TD>, can not only represent the information of different rows and columns in the table, it may also be used for webpage layout. As a result, HTML is more and more focused on information representation, and the meaning of the weak Information Description in the tag is also weakened. Finally, HTML has finally evolved into a page display language specifically for Netscape and Microsoft IE browsers.

Maybe you think that some of the requirements of some special users are not met, but after all, the most basic problem for most people to browse the page-display problem is solved. In addition, with these dedicated display labels, this problem is well solved! Actually not. Browser manufacturers in the fierce market competition, in order to display their own uniqueness, ie and Netscape have added some special tags to HTML, in order to add some special display effects to your browser. The increasing number of tags not only makes HTML more and more complex, but also reduces the compatibility between different browsers. For example, if your webpage is made for the ie5 browser and 800*600 screen resolution, the effect of viewing on the 640*480 screen will be greatly reduced, in the Netscape browser, the display effect is even different from the original design concept.

In addition, despite the increasing number of HTML tags, the display power is far from enough. If you want to accurately present your own data, you may need tags that do not yet exist in HTML. For example, if you are a chemist, you may need to represent some special symbols in the chemical molecular formula. For example, you are an airplane designer and want to be able to express the engine of an airplane. However, HTML is beyond reach. To meet the different display requirements of various industries, a large number of tags are needed, which undoubtedly makes the increasingly bloated HTML worse.

There are more and more problems. Now, the internal structure of HTML is getting worse and worse. The HTML file you write, or even the HTML file automatically generated by the dedicated WYSIWYG tool, may be a hundred errors in syntax, but it doesn't matter, the browser can still read it. Files in HTML can be non-nested, for example,

In addition, there are more people who are helpless to HTML, that is, search engine developers. From the HTML Tag itself, they hardly get any useful information. If you want to go online and find out the prices of all the XML books in the world, the search engine will be too busy. It needs to identify which "XML" fields on the network correspond to the name of the book, and know the price corresponding to these titles. Maybe you will say, isn't it done on the webpage of our library? This is where the library searches based on internal databases, and each field in the database has a clear meaning. However, search engines search based on HTML files on the Internet. The contents of databases with clear and hierarchical structures have long been messy by various tags in HTML files, the search engine has to find a needle in these chaotic contents!

These many drawbacks of HTML have brought it into a situation of "no doubt. Then, how does XML bring about "a different Village?

With the rapid development of the Internet in today's world, HTML has indeed made great achievements, and we cannot erase its credit. Next, let's look ......

[This post was edited by the author at 10:49:14]

----------------------------------------------
Http://alonglee.net specializes in data collection time to see

Reward gold coins: 0 gold coins deducted: 0

2004-10-7 9:25:00
The VM instance quota can be expanded by 50% for free. [Post operations] [use items]



Alonglee



Title: I may be right.
Level: Hero of Xia
Article: 597
Credit: 1766
Registration: 2003-7-13

2nd floor

 

<! -- Body content -->

1.2.2 XML's biggest advantage-a free and democratic online world

XML seems to act as a declaration of freedom. It breaks the monopoly of tag definition and changes the online world into a more free and democratic world.

I wonder if you know how difficult it is to define a slogan and use it in the absence of XML. On the one hand, if you develop a new language and expect it to take effect, you need to submit this standard to relevant organizations, such as W3C, waiting for it to accept and officially announce this standard, after several rounds of evaluation, modification, re-evaluation, and re-modification, your slogan will finally become a formal recommendation standard, and may have been in a hurry for several years. On the other hand, to make this set of tags widely used, you must equip it with a browser tool. In this way, you have to lobby various browser vendors to accept and support your tags, or simply develop a new browser to compete with the existing browser. No matter which method is used, it is daunting!

Now with XML, you can finally customize your own slogan without having to remember the approval of Microsoft, Netscape, and W3C.

Of course, do not think that the main purpose of XML is only to provide a peaceful atmosphere and reflect the main melody of freedom and equality in the new era. It plays a real role in network applications. As we all know, different industries may have some unique requirements. For example, the chemist needs some special symbols in the chemical formula, some special marks in the architectural design drawings, and the music notes, all of which need to be individually labeled. However, other web designers do not need or need these marks. XML is good because it allows organizations and individuals to create a tag library suitable for their own needs, and this tag library can be quickly put into use.

Not only that, as the world is becoming more and more diversified, it is not necessary to define a set of tags suitable for all walks of life and can be applied universally. XML allows different industries to develop their own set of tags based on their unique needs, but it does not force all browsers to handle these thousands of strange tags, similarly, it does not require the makers of slogans to develop a very detailed and comprehensive language that is suitable for applications in various fields of various industries. Compared with the practice of pursuing big and comprehensive slogans, the specific analysis of such specific problems is actually more conducive to the development of slogans.

"From the beginning of the network, we have been using almost the same format in all files. html format... using a fixed tag set with fixed syntax has some benefits, that is, simplicity. However, HTML is very limited, and web designers want to have more control over the page performance, which requires the help of XML.

-- Norman Walsh"

In fact, many industries and organizations have used XML to define their own slogans. Early and typical examples are the following two instances:

  1. Chemistry markup language, by Peter Murray-rust
  2. Mathematical Markup Language (MathML) 1.0 specification, W3C recommendation 07-0000l-1998

Well, we have talked a lot about how XML breaks through the Basic tag set like HTML. In fact, this advantage is far from the biggest advantage of XML. So what is its biggest advantage?

----------------------------------------------
Http://alonglee.net specializes in data collection time to see

Reward gold coins: 0 gold coins deducted: 0

2004-10-7 9:25:00
Dynamic Network Forum host, cost-effective support [Post operations] [use items]



Alonglee



Title: I may be right.
Level: Hero of Xia
Article: 597
Credit: 1766
Registration: 2003-7-13

3rd floor

 
<! -- The following content is the subject -->

<! -- Body content -->

1.2.3 The second advantage of XML -- beyond the format

The maximum energy of XML comes from not only allowing you to define your own set of tags, but also not limited to the description of the display format. XML allows you to set tags based on different rules, such as business rules, data descriptions, and even data relationships.
Maybe you have not considered this as a benefit. Well, do you still remember the example in the previous two sections about the customer list of Company F? Now, let's make a detailed comparison of two different files.

When this file is written in HTML, the file looks like this:

<Ul>
<Li> Zhang San </LI>
<Ul>
<Li> User ID: 001 </LI>
<Li> company: Company A </LI>
<Li> Email: zhang@aaa.com </LI>
<Li> Tel: (010) 62345678 </LI>
<Li> address: No. 1234, wujie </LI>
<Li> City: Beijing </LI>
<Li> Province: Beijing </LI>
<Li> ZIP: 100001 </LI>
</Ul>

<Li> Li Si </LI>
<Ul>
<Li> ID: 002 </LI>
<Li> company: Company B </LI>
<Li> Email: li@bbb.org </LI>
<Li> Tel: (021) 87654321 </LI>
<Li> address: No. 9876, Nanjing Road </LI>
<Li> City: Shanghai </LI>
<Li> Province: Shanghai </LI>
<Li> ZIP: 200002 </LI>
</Ul>
</Ul>

Although this is also a feasible way to store and display data, its efficiency and capabilities are very limited. I wonder if you have the same feeling. There are many potential problems when using HTML that focuses on performance to mark your data. We can see at least three serious problems:

  1. Display Mode embedded in Data
    As you can see, the data is displayed in the form of a list. If one day your boss asks you to use a table to represent the data, you have to recode all such HTML files! Oh, my God, this may mean that dozens of pages, hundreds of pages, will be overturned!
  2. It is very difficult to find information in the data.
    What if one day you need to find information about all customers in Beijing from this webpage? Obviously, if you are not looking for it manually, You need to compile a script program, such as JavaScript and VBScript. So, how do you write this program? The only feasible method is to find the string "Beijing" by word. Even if you find all these fields, I am afraid you have not solved all the problems. Does "Beijing" mean a city or a province? (Don't forget the suburbs around Beijing .)
  3. The logic of the data itself has to succumb to the logic of the HTML language specification.
    If you want to use a Java applet to process your data, you have encountered another problem. Your Java Applet will have to traverse the entire HTML file, remove all HTML tags, and re-organize the useful data. Similarly, any application that does not simply display HTML files has to do a lot of extra work when processing data in an HTML file.

When using XML, the above problems can be solved. In this case, the following information is displayed:

<Contact list>
<Contact>
<Name> Zhang San </Name>
<ID> 001 </ID>
<Company> Company A </company>
<Email> zhang@aaa.com </Email>
<Phone number> (010) 62345678 </phone number>
<Address>
<Street> No. 1234 Fifth Street </street>
<City> Beijing </city>
<Province> Beijing </province>
<Zip> 100001 </zip>
</Address>
</Contact>

<Contact>
<Name> Li Si </Name>
<ID> 002 </ID>
<Company> Company B </company>
<Email> li@bbb.org </Email>
<Tel> (021) 87654321 </Tel>
<Address>
<Street> No. 9876 Nanjing Road </street>
<City> Shanghai </city>
<Province> Shanghai </province>
<Zip> 200002 </zip>
</Address>
</Contact>
</Contact list>

It can be seen that the data marked as the data to be presented has given some meaning. When stored in this form, the data is very simple and clear, because the information it carries is not the display description, but the meaning of the information. As we will see later, the information display method has been extracted from the information itself and placed in the "style sheet.

Well, now let's take a look at how the three XML problems mentioned above are solved one by one.

  1. In XML, the display style is extracted from the data information and placed in the style sheet file. In this way, if you need to change the information, you do not need to change the information itself. You only need to change the style sheet file. If the boss asks you to change the list data to table display at this time, you do not need to modify the dozens or even hundreds of data information files because they are associated with the same style sheet file, you only need to change the style sheet file.
  2. You can search for data in XML in a simple and efficient manner. The search engine does not need to access the entire XML file any more. It only needs to find the content under the relevant tag. That is to say, to find "Beijing", just check whether the string data under the <city> mark matches. It is no exaggeration to say that the XML Mark gives the search engine intelligence!
  3. XML is a self-describing language. Even for someone who knows nothing about our fclml in advance, this file is clear and readable. Obviously, <ID> 002 </ID> represents the customer identity of a customer. However, if a customer faces <li> 002, he may be confused. Then, look at the strict hierarchy in the above file, and you will find that some complex relationships between information, such as tree structures and inheritance relationships, are also perfectly reflected here. In this way, the XML application processing programs will feel much easier.

Here, you may have been satisfied with XML. However, XML has many advantages.

----------------------------------------------
Http://alonglee.net specializes in data collection time to see

Reward gold coins: 0 gold coins deducted: 0

2004-10-7 9:26:00
Dynamic Network Forum Business Edition, professional and high-performance embodiment [Post operations] [use items]



Alonglee



Title: I may be right.
Level: Hero of Xia
Article: 597
Credit: 1766
Registration: 2003-7-13

4th floor

 
<! -- The following content is the subject -->

<! -- Body content -->

1.2.4 Other advantages of XML

The two advantages of XML mentioned above are the most prominent advantages of XML. In addition, XML has at least three advantages.

  1. XML follows strict syntax requirements

    As mentioned above, the syntax requirements of HTML are not strict, and the browser can display HTML files with syntax errors. But XML is different. It requires not only tag matching and nesting, but also strict compliance with DTD rules, such as the previous client. in XML, you must not mark the <contact> </contact> pair, and add a <address> </address> tag.

    "Unlike HTML, XML is very accurate. If a syntax error occurs, the analyzer stops processing it. Accordingly, you cannot see any display information except the error prompt.

    For example, processing instructions are required for any XML file. If an HTML file does not start to mark <HTML>, it can still be passed in most browsers. Because browsers usually have a built-in modification function to guess what is missing in the HTML file and try to modify this incorrect file. XML analyzer, whether embedded in a browser or as an independent processor, cannot be modified. Just like compiling a program, an XML file is accepted or identified as 'true', or not run if it is identified as 'error. This may seem a bit arbitrary, but think about the purpose of XML is to pass structured data through non-standard tags, an analyzer cannot guess what is missing like processing an HTML file with a fixed DTD.

    -- Ken Sall"

    Once I heard that strict syntax requirements should be followed when writing XML files, web page makers who are spoiled by HTML may complain. In fact, if you think about it, a webpage file with a good syntax structure can provide better readability and maintainability. In the long run, it will be of great benefit. In addition, this greatly reduces the burden on browser developers and improves the efficiency of browser time space. Furthermore, with the advent of the XML Automatic Generation Tool and WYSIWYG editor, XML writers will no longer have to worry about what the XML source code looks like, you do not need to think about the trivial Syntax of XML. Of course, the requirements for such XML development tools are relatively high.

  2. XML facilitates the transmission of information between different systems

    In today's computer world, there are many different systems in different enterprises and departments. The operating systems include nt and UNIX, and the database systems include SQL Server, Oracle ,..., to transmit information between these platforms and different database software, you have to use some special software, which is inconvenient. Different Display Interfaces, from workstations, personal computers, to mobile phones, make personalized display of such information very difficult.

    With XML, different systems can use XML as the communication media. XML is not only easy to read, but also can mark a variety of text, images and even binary files. With XML processing tools, you can easily read and use the data, makes XML an ideal Internet language.

  3. XML has good value-preserving

    XML value preservation comes from the SGML language, one of its pioneers. SGML is a set of international standards with a history of more than 10 years. Its initial design goal is to provide documents with a life cycle of more than 50 years. Don't underestimate the lifetime of documents. Think about how we know the long and brilliant history of our ancestors. If it is not a large number of historical documents that have been circulated so far, we may not have any idea about the "Tang, Song, and Qing Dynasties". Similarly, Our Future Generations also need to learn about us through the texts we leave. However, most of the materials are in the form of electronic documents, and some people have been eager to print them and archive them separately, but leaving only one copy will make everything better. The seeds of evil are buried in this way. Assume that fifty years later, your children and grandchildren will face a lot of documents you have left on using word97, no software tool can open (Can you still open the file originally written in wordstar1.0 ?), Will this history be erased? If there is no XML, I am afraid there are only two ways to do this: do not go back to the ground and continue to use the paper media, or do not bother to convert your documents to the latest format on a large scale as the software is updated.

    Fortunately, the technology foresight at the end of the 20th century successfully solved this problem. This is the design of SGML and XML. They can not only serve as a general standard for a long time, but also easily convert to other formats of files. Do you want to leave the marks of the past years? XML is your wise choice.

So far, we have elaborated on the five advantages of XML. However, everything is not perfect, and XML also has some inherent defects. Although these defects are not irreparable, they are on the sunshine avenue of XML, it also cast some small shadows.

----------------------------------------------
Http://alonglee.net specializes in data collection time to see

Reward gold coins: 0 gold coins deducted: 0

Related Article

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.