XML”What Is It and Why Should I Use It?XML is a set of language rules that have been defined to describe and structure data. It was originally developed by the World Wide Web Consortium (W3C) as part of an effort that started in 1996 and produced the first XML specification (version 1.0) in 1998. Their goal at the time was to expand web functionality by providing a flexible architecture for exchanging data. The architecture supports more than the typical web client-server relationship between a browser and a web server. That is, XML isn't just for web pages. XML can store any type of structured information. One benefit of storing standard data (that is, not web related ) is that XML can be used to facilitate data communications between two computer platforms that would otherwise be incompatible as well as store configuration or application data for easy access by the applications. A number of features are what make XML so successful”let's take a quick look at them. XML Is ExtensibleXML is called extensible because it isn't based on a rigid set of rules like HyperText Markup Language (HTML). HTML and XML are both subsets of Standard Generalized Markup Language (SGML) and have their similarities and differences. HTML defines a standard set of tags, and because each tag has a predefined meaning, the language is not extensible. Because HTML tags are already defined as a standard, the HTML interpreter (the browser, for example) does not have to interpret any tags that are not a part of the HTML standard. The interpreter is free to choose whether or not it wants to ignore the tags, throw an exception, display it as plain text, and so on. XML, on the other hand, is a meta-language that can be used to structure your data and define other meta-languages. In essence, when you generate an XML document, you are actually defining a new data format or a new meta-language because you define the start tags, end tags, and so forth.You then create an interpreter for your language using an XML Parser, which will understand the user -defined syntax.You can also create a Document Type Definition (DTD) to further validate and restrict your language's syntax. Note Even though XML is a meta-language, it still has to follow a set of syntax rules to render a valid XML document. These rules are defined in Appendix A, "What is XML?" XML Separates Data from the Presentation of the DataThe data contained in an XML document is separated from the presentation of the document. This feature enables you to decide how to display the data contained in an XML document based on the client viewing the XML document (that is, different clients can view the same data in different ways). Technologies such as eXtensible Stylesheet Language Transformation (XSLT), XML Path Language (XPath), Cascading Style Sheets (CSS), and so forth can be used to transform XML documents for varying presentations to the viewer. XML Documents Are Stored As TextAn XML document is stored as text.You can view and edit an XML document easily using any text editor because its legibility makes development and debugging much easier than in binary or other illegible formats. Because an XML document is a text file, it is not platform specific. By that, I mean an XML document generated on one platform”for example, a PC running Microsoft Windows”can be used ( viewed , read, or processed ) on another platform, such as a Unix workstation. Cross platform portability can sometimes be an issue when applications store their data in a proprietary binary format (such as a word processor document or a spreadsheet). Think of an XML document as a clear glass container that holds data”everyone can see inside of it and nothing is hidden, which is how information or data should be treated. XML Provides a Solid Foundation for a Family of TechnologiesXML itself is the specification that describes the rules designed to store and represent data. It specifies how start and end tags are defined, which characters are allowed for element names , how comments are written, and so on. In addition to XML, a large number of related specifications are designed from the beginning to closely integrate with XML. Here is a short list of some of the more popular specifications.
XML Is Not a Transport ProtocolOne of the few misconceptions about XML is that it is a transport protocol” it isn't.You cannot use or open an XML-based socket between two processes (for example, a browser client and a web server) to exchange data.You can, however, open up a TCP socket (for example, a browser client and a web server) and exchange a file that contains data stored in XML. XML Is Not a Programming LanguageAnother popular misconception about XML is that it is considered a programming language. XML is not a programming language. XML cannot calculate the average of the first column of a table of data; however, an XML document can store the data from the table. Tools have been written using a number of programming languages (such as Perl, C/C++, and Java) that can generate, build, or parse XML documents, but an XML document is not a script or a source code file. There are several XML-based languages, and XSLT is a good example. XSLT programs are written using XML constructs, which are then interpreted and executed as defined in the specification. XSLT interpreters can be written in languages such as C, C++, Perl, or Java. XML-based languages are a hot topic in the compiler and interpreter communities right now because many developers are beginning to see the benefits of using XML-based syntax, which easily defines things such as validations using DTDs or schemas, and namespaces. |