Extensible Markup Language (XML) is a specification that has been developed for transmitting information over the Web. XML is based on the Standard Global Markup Language (SGML) and is a cross-platform, software- and hardware-independent tool. In addition, it has the following attributes:
Is a markup language much like HTML.
Is designed to describe data.
Can be used for all types of data and graphics.
Is independent of applications, platforms, or vendors.
Allows designers to create their own customized tags, enabling the definition, transmission, validation, and interpretation of data between applications and between organizations.
XML tags are not predefined. You must define your own tags.
XML is not a replacement for HTML
XML and HTML were designed with different goals. XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks.
Why Use XML?
Companies are moving their documents into XML for several reasons:
Reuse – separation of content from presentation enables multiple delivery formats.
Portability – XML is an international, platform-independent standard based on ASCII text, so companies can safely store their documents in XML without being tied to any one vendor.
Interchange – XML is a core data standard that enables XML-aware applications to interoperate and share data seamlessly.
Self-describing – XML is in a human readable format that users can easily view and understand.
XML data format conforms to the rules of the XML language 1.0 specification, as published by the worldwide Web Consortium (W3C). The format includes elements, content particles, pcdata, and attributes.
There are two types of XML data:
Valid – A document type definition (DTD) or schema must be used and applied against the data to have a valid XML document.
Well-formed – The document is not validated against a DTD or schema and only needs to follow basic XML structure rules.
DTDs and schemas are sets of rules that apply to valid data.
DTDs are rules created in text using any text editor.
Schemas are sets of rules created using a schema language.
XML Predefined Entity References
XML comes with the following predefined references:
These are used when you have to place any of the reserved characters in your data.
Example: AT&T would be written AT&T.
It is important to understand that XML was designed to store, carry, and exchange data. XML was not designed to display data.
Using XML to Exchange Data
With XML, you can exchange data between incompatible systems. One of the most time-consuming challenges for software developers has been to exchange data between computer systems and databases that contain data in incompatible formats. Converting the data to XML can greatly reduce this complexity and create data that can be read by many different types of applications.
Using XML to Enable B2B Transactions
Using XML, you can exchange financial information over the Internet. XML might soon become the main language for exchanging financial information between businesses over the Internet. Several interesting B2B (Business To Business) applications are currently under development.
Using XML to Share Data
With XML, you can use plain text files to share data. Since XML data is stored in plain text format, it provides a software- and hardware-independent method of sharing data. This makes it much easier to create data that different applications can use. It also makes it easier to expand or upgrade a system to new operating systems, servers, applications, and browsers.
Using XML to Store Data
With XML, you can use plain text files to store data. You can use XML to store data in files or in databases. You can write applications to store and retrieve information from the store and use generic applications to display the data.
Using XML to Provide Greater Availability
Using XML, your data is available to more users. Since XML is independent of hardware, software, and applications, you can make your data more widely available than to only standard HTML browsers. Other clients and applications can access your XML files as data sources, just as they would access databases.
XML syntax rules are very simple and very strict. For this reason, creating software that can read and manipulate XML is very easy to do.
The following is an example of an XML document:
<?xml version= “1.0” encoding=“ISO-8859-1”?>
<body>See Spot run!</body>
The first line in the document is the XML declaration. It defines the XML version and the character encoding used in the document. In this case, the document conforms to the 1.0 specification of XML and uses the ISO-8859-1 (Latin-1/West European) character set. The XML declaration is not a part of the XML document itself, and therefore does not require a closing tag.
The next line describes the root element of the document. In this example, it is saying, “This document is a note.”
The next four lines describe the four child elements of the root: to, from, heading, and body (each of which has start and end tags).
The last line defines the end of the root element: </note>.
Writing Comments in XML
Use the following syntax for writing comments in XML:
<!– This is a comment –>