Lesson 4 | HTML limitations |
Objective | Describe the limitations of HTML. |
Limitations of HTML
The primary limitation of HTML is that HTML tags do not describe the meaning of the data included in an HTML document.
HTML uses a fixed, predefined tag set that specifies formatting and instructs a browser how to render data included in these tags.
But the tags do not convey the meaning or semantics of data contained in the tags. In many cases, the meaning of the data included in a document is critical. XML is designed to overcome this and other limitations of HTML. A classic example in which this limitation of HTML is problematic is Web searches. When you try to search for a document on the Internet on the basis of a word or phrase, you will literally get thousands of matches. The search engine does not use the HTML tags but instead relies on keywords and meta-tags in the HTML document.
For example, if you want to search for information relating to the box office performance of the 1997 film Titanic, you might be deluged with articles about the ship Titanic, the numerous books about its fatal voyage, or pages of sales promotions touting "titanic" discounts.
An advanced search might return the exact information you want in the first few search results, but the search is still not efficient.
The Advent of XML
Unlike HTML tags, XML tags do convey meaning. XML tags make
searching for information more efficiently. For example, to describe the movie Titanic we may use the following set of elements:
Perform Targeted Searches using XML
With the advent of XML, search engines are able to perform more directly targeted searches, enhancing the precision of the results.
Consider the value of being able to define content by comparing the following code examples:
"The best picture award in 1998 went to the film
Titanic"
In this example, a search engine cannot determine whether you are referencing a ship, a play, a film, or an adjective.
The second markup example is more useful:
The best picture award in 1998 went to the film
<FILM>Titanic</FILM>.
Reference to Titanic
Now you know that this reference to Titanic is a reference to a film by that name.
The last example takes XML a step further:
The <ACADEMY-AWARD-CATEGORY>best picture
</ACADEMY-AWARD-CATEGORY> award in
<YEAR>1998</YEAR> went to the film
<TITLE MEDIA="Film">Titanic</TITLE>.
HTML 5 Responsive Web Design
The last example makes the most "intelligent" document because the markup is explicit as to what the document contains.
If you were to ask an intelligent search engine the question "Which film won the Academy Award for Best Picture in the year 1998?"
this document would have a high degree of precision in matching your search query.
<FILM>
<TITLE> Titanic </TITLE>
<PRODUCER>James Cameron, Jon Landau</PRODUCER>
<DIRECTOR>James Cameron</DIRECTOR>
<SCREENWRITER>James Cameron</SCREENWRITER>
<DISTRIBUTOR>Paramount</DISTRIBUTOR>
<BOX-OFFICE>$376,270,721</BOX-OFFICE>
</FILM>
Titanic as the Title
When these elements are included as part of a document on a server, a search program would have no problem identifying Titanic as the title of a film. In addition, the computer search program would be able to identify other attributes of the Titanic film such as its producer, director, and so on.
Structural Definition
XML elements not only convey the meaning of data,
but also enforce a well-defined structure for the data. XML elements may also contain other elements and a tree-like structure for this document is easily identified. The structural definition of an HTML document is not as easily discernable. In the above example, the XML
<FILM>
element contains
<TITLE>
,
<PRODUCER>
,
<DIRECTOR>
,
<SCREENWRITER>
,
<DISTRIBUTOR>
, and
<BOX-OFFICE>
elements.
Each of these elements, in turn, contains data. The well-defined structure of an XML document is important when you use
XML parsersas you will see later in the course.
Advantages of XML
One of the aims of XML is to implement a clear separation between data and presentation. This means that the same underlying data can be used in multiple presentation scenarios. It also means that when moving data, across a network for example, bandwidth is not wasted by having to carry redundant information concerned only with the look and feel. This separation is simple with XML as there are no built-in presentational features such as exist in HTML, and is one of its main advantages.
The next lesson defines XML.
MetaLanguages Markup - Quiz
