Introduction
XML, or Extensible Markup Language is a tag language you can use to create your own tag. It is created by the World Wide Web Association (W3C) to overcome HTML (ie hypertext markup language, which is the basis of all web pages). Like HTML, XML is based on SGML-Standard Generalized Markup Language. Although SGML has been used for decades in the publishing industry, the complexity of understanding makes many people who intend to use it (SGML also represent "sound great, but maybe it will be used later (Sounds Great, Maybe Later) "). XML is designed for web.
Why do we need XML?
HTML is always the most successful markup language. You can easily view the simplest HTML tags on any device (from the handheld to the mainframe), and you can even use the appropriate tool to convert the HTML tag into voice and other formats. Since HTML is successful, why is W3C to create XML? To answer this question, please see the following document:
mrs. Mary McGoon b>
1401 Main Street
Anytown, NC 34829 P>
HTML problem is that it is designed for people. Even if you don't have a browser to view the above HTML document, you and I will know that it is a person's postal address. (Specifically, it is a post address of a US person; even if you are not familiar with the format of the US postal address, you may also guess what this is said.) As a person, you and I have the meaning of most documents. And intention of wisdom. Unfortunately, the machine cannot be done. Although the tag in this document tells the browser how to display this information, but the tag does not tell the browser information. You and I know that it is an address, but the machine does not know.
Show HTML
To display HTML, the browser simply follows the instructions in the HTML document. Segment tag tells the browser to display in the new line, and usually have an empty line in front, and the two wrap tags tell the browser to advance to the next row, and there is no time between the lines. Although the browser formats the document well, the machine still doesn't know that this is the address.
Handling HTML
In order to complete discussions on sample HTML documents, consider the task of extracting postal codes from this address. Below is an algorithm for finding postal coding in an HTML tag (I intentionally use fragile algorithm):
If you have two
Marked paragraph, then postal code is the second word after the second wrap mark below the first comma.
Although the algorithm acts for this example, the algorithm does not work at all for many fully and effective addresses worldwide. Even if you can write an algorithm to find any postal code written in HTML, many paragraphs with two wrap tags do not contain addresses at all. Even if there is a possibility to write an algorithm to see any HTML paragraph and find any of these postal codes, it is also extremely difficult.
Sample XML document
Let us now look at a sample XML document. Using XML, you can give a mark to your documentation. More importantly, the machine is also easy to handle such information. You only need to find a postal code from this document by finding the content between the
Mary
first-name>
McGoon
last-name>
name>
1401 Main Street
street>
34829
postal-cotne
address>
Tag, element and attribute
There are three general terms to describe components of the XML document: tag, element, and attributes. The sample documentation below illustrates these terms:
Mary
first-name>
McGoon
Last-Name>
name>
1401 Main Street
street>
34829
postal-cotne
address>
The tag is the text between the left parentheses (<) and the right parentheses (>). There is a start tag (such as
How XML is changing with Web
Since you have seen developers to create documents with self-descriptive data using XML, let us see how people use these documents to improve the web. The following is a few key areas: