Today XML is an industry-standard, extensible, system-independent way of representing and exchanging data. This is achieved in two ways: -
The use of a tagging mechanism in which the tags indicate the content and structure of the data they enclose. For example, the following code shows how the information about a book is stored in an XML document: <booklist> <book> <name>Java APIs for XML</name> <author>Aoyon Chowdhury and Parag Choudhary</author> <isbn>1234</isbn> <publisher>sams</publisher> <price>40</price> </book> </booklist> The <book> and the </book> tags tell a parser that the information between them is about a book. The other tags specify the book's author, ISBN number, publisher, and price. Similarly, you can define and use your own tags to describe your content. The fact that the tags are user-defined is what gives XML its extensibility. -
The portability of data is ensured by the use of DTDs, or XML Schemas. DTDs describe the tags, and the order in which they can appear in an XML document. These provide a consistent understanding of the XML data by different applications. For example, the DTD for our book would be as follows: <!ELEMENT bookList(book)+> <!ELEMENT book (name, author, isbn, publisher, price) > <!ELEMENT name (#PCDATA) > <!ELEMENT author(#PCDATA) > <!ELEMENT isbn (#PCDATA) > <!ELEMENT publisher(#PCDATA) > <!ELEMENT price(#PCDATA) > Therefore, any application, when given the bookList XML file along with the bookList DTD, can process the document as per the rules specified in the DTD. This implies that applications residing on different platforms and operating systems can share data with each other, as long as they agree on the format and the structure of the content. XML is fast becoming the communication medium of choice for enterprises sharing data within their own departments or with other enterprises. The Internet world is also seeing a new breed of applications called Web services. These applications can share information between enterprises using XML as the communication medium and Internet protocols as the backbone. |