What Exactly Is XML?


To get a good idea of what XML is, you also need to know what XML is not. I'll cover some of those misconceptions in the following section, but for now, let's cover what XML is ”a language that was designed to facilitate the exchange of information.

Note

One of the best sources for XML information is at the World Wide Web Consortium (W3C) web site (http://www.w3.org). The W3C publishes the XML standards as well as most (if not all) of the World Wide Web- related standards.


XML Applications

XML and the related technologies can be applied to a number of applications. Before I actually start discussing some of the characteristics of XML, let's take a moment and look at some of the important applications of XML. Currently, three of the main applications of XML are

  • Data Interchange ” XML is widely utilized to facilitate the exchange of data between organizations. Different organizations can develop a DTD or XML schema that defines the contents of an XML document. A DTD or XML schema acts as a contract between the participating organizations. An XML parser can easily verify that the XML document is valid, that is, conforms to the DTD or XML schema.

  • Defining Custom Documents ” Unlike HTML, which has a finite set of tags, XML doesn't have any defined tags, so users are free to define their own (provided they follow the XML formatting and structure rules). XML enables users to easily define application-specific XML documents for standardized communication.

  • Generate Easily Transformed Data ” XML provides a very flexible initial data format, especially when combined with the XSL facilities. By employing an XSLT stylesheet, you can easily transform an XML document into a plain text format (for example, tab-delimited, CSV), an HTML document, or another XML document. As you can see, this provides the end user with a great deal of flexibility to use the same data in a number of different formats.

Characteristics of XML

XML can be easily described by a few key characteristics that provide a clear, high-level description. This section provides a short list of the more important characteristics.

  • An XML document is stored as a plain text file. This means that you can open an XML document with any editor. Text files are portable across platforms, while binary files can be platform-specific. In addition, because an XML document is stored as plain text, it is easier to find errors in the XML document ”nearly an impossible task with a binary file.

  • XML was designed for and works best with structured data. An example of structured data is a database table or the contents of a spreadsheet. These data sources are called structured because they can be broken down into records (or rows), and each row is made up of multiple columns (or cells ). Because XML is hierarchical, complex data structures can be defined within the XML document.

  • XML separates data and presentation. Unlike HTML that mixes data and formatting of the data, XML was designed to consist of data only. This leaves you, as the developer, free to present the data in the best way you see fit. This is also important because it enables you to format the same data several different ways. For example, the same data can be formatted for presentation on both a Personal Computer (PC) and a handheld Personal Digital Assistant (PDA).

  • XML is self-describing . A well-designed XML document with clearly defined element names is easy to read and understand. This means that when you open up an XML document in a text editor, you should be able to easily see all the elements in an XML document and the relationship between the elements (that is, the element hierarchy). If the elements in an XML document are assigned descriptive names , you may not even need to insert any comments into the XML document.

  • XML is publicly available and very popular.You don't need to worry about any licensing issues with XML, and, because XML is so popular, it's easy to find a lot of documentation, both in print and online. Books, magazines, web pages, mailing lists, and newsgroups are dedicated to XML. Look at the section, "Additional Sources of XML Information" at the end of this Appendix for a list of resources.

  • XML has launched an entire series of related standards. A number of important related standards are built upon XML. Some of the more popular XML-based standards include XLink, XPointer, XSL, and XSLT. Full definitions of these terms can be found in the Glossary.

What XML Isn't

Now that I've shown a few characteristics of XML, let's reverse things a bit and clarify a few misconceptions that exist about XML.

  • XML is not a transport protocol. Sometimes, XML is confused with a transport protocol, and developers mistakenly believe that they can communicate between two processes using XML. XML cannot be used as a transport protocol.You can, however, send XML between two processes using a transport protocol (for example, TCP or UDP). An example of this would be a TCP server that is waiting for incoming connections from clients . A client can open a socket and connect to the server, and send (or receive) an XML document.

  • XML is not a programming language. XML was designed as a common language to support the sharing of data between applications. Perhaps people sometime confuse XML and XML parsers. An XML parser is used to read an XML document, and XML parsers are available in a number of languages including C/C++, Java, and Perl.

  • XML is not a replacement for HTML. Both XML and HTML have the same ancestor , SGML. They perform different tasks . Remember, HTML combines data with the presentation of the data, while XML separates the data from the presentation.



XML and Perl
XML and Perl
ISBN: 0735712891
EAN: 2147483647
Year: 2002
Pages: 145

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net