XMLAs soon as users, vendors, and Web designers became accustomed to HTML, they started to ask for more. The growth of server-side and client-side programming techniques, and the evolution of the Web services architecture, which you'll learn about in Hour 23, "Recent and Emerging Technologies," caused many experts to wonder if there might be a way to extend the rigid tag system of HTML. Their goal was to get beyond the conception of a markup language as a means for formatting text and graphics and to employ the language simply as a means for transmitting data. The result of this discussion was a new markup language called Extensible Markup Language, or XML. As you learned earlier in this hour, the meaning and context for HTML data is limited to what you can express through a set of predefined HTML tags (refer to Table 17.2). If the data is enclosed in <H1> tags, it is interpreted as a heading. If the data is enclosed in <A> tags, it is interpreted as a link. XML, on the other hand, lets users define their own elements. The data can signify whatever you want it to signify, and you can invent the tag you will use to mark the data. For instance, if you follow horse racing, you could create an XML file with information on your favorite horses. That file might contain entries such as: <horses> <horse_name="winky" breed="Thoroughbred"> <sex="male" /> <age="3" /> </horse> <horse_name="Goddess" breed="Arabian"> <sex="female" /> <age="3" /> </horse> <horse_name="Gecko" breed="Uncertain"> <sex="male" /> <age="14" /> </horse> </horses> XML format looks a little like HTML, but it certainly isn't HTML. (Can you imagine how much your browser would choke if you tried to pass off <horse_name> as an HTML tag?) You can use whatever tag you want to use in XML, because you aren't preparing the data for some specific, rigidly predefined application like a Web browser. The data is just data. The idea is that whoever creates the structure for the file will come along later to create an application or style sheet that will be able to read the file and understand what the data means. XML is an extremely powerful tool for passing data between applications. It is very easy for a script or homegrown application to create XML as output or read XML as input. Even though a browser can't read XML directly, XML is still used extensively on the Web. In some cases, the XML data is generated on the server side and then converted to display-ready HTML before it is transmitted to the browser. Another technique is to provide an accompanying file called a Cascading Style Sheet (CSS) that tells how to interpret and display the XML data. However, XML is not limited to the Web. Programmers now use XML for other contexts that require a simple, convenient format for assigning values to attributes. XML now reaches far beyond the ordinary Web as a format for storing and transmitting data. As long as the application that writes the XML data and the application that reads the data agree on the meaning of the elements, the data passes easily and economically between the applications through the miracle of XML. By the Way XML is often described as a "markup language for creating markup languages." |