XML in Application Development

Are you contemplating your next application development project? Whether it's an Internet or client/server based application, one question raising some debate is how to get the data out of your iSeries and into your proposed application. If you are developing a client/server application, you may be considering ODBC or JDBC as your middleware. If it's an Internet application, it may be JDBC or, simply, direct database calls. These methods require access to your database and may not provide all of the features that you need; not to mention, these methods may not be able to "speak" to other applications on your iSeries, or on other platforms.

There is a technology that solves these issues and more -- XML. XML provides a customizable method to exchange data between applications and platforms. This is a simple extension to the already successful HTML language and provides an excellent solution to many application development issues.

What is XML? XML (Extensible Markup Language) is the framework for defining document markup languages. With XML, you can define your own markup language, whereas HTML (Hypertext Markup Language) is extremely limited in its capabilities. With XML, XML-enabled devices can understand the information much easier, and, thus, process the information much faster. In some cases, the types of actions that XML can accomplish are impossible with HTML. For this reason, XML was created.

XML overcomes these limitations of HTML, while providing capabilities that are not a part of the earlier languages. In an XML document, the tags that have been entered identify the meaning of the data they contain. These tags are known as nodes. To define a node in greater detail, attributes can be used to help describe the node. The structure of the XML data is far easier to understand, as it is based on the names given by the programmer, and is not cryptic. In comparison, HTML tags reveal little about the meaning of their content. This makes it harder to update the data or the format in the event of policy or system changes. The structure is not particularly useful for manipulating, as the names, and tags are not easily identifiable. This type of interchange may require much more programming, and is increasingly difficult to maintain, because the information has to be shared between applications. Remember, XML is not based on any specific platform, and, as a result, can be freely interchanged between platforms.

Without XML, you would require some sort of middleware to access your data and deliver it to your application. Many middlewares may have predefined rules that can cause a great deal of overhead in your environment. If you are transferring information to, or from, another platform, marshalling may be required. With XML, however, marshalling is not required and DTDs (Document Type Definition) ensure that data integrity is kept. Some middleware may not even provide you all of the functionality that you require in the way of complex data transfer, or may require multiple transfers to obtain the same result as a single XML transfer.

How does your application get the information out of an XML document? The process to get the information is called parsing. It is the ability to get the information out of the nodes, or attributes, by looking for a specific node. There are many XML parsers available. Two of the most popular, SAX and DOM, are available as Java classes that can be placed in your Java solution. Remember that the XML document is a text file, and you can create your own parser to get the information you need out of the document. The standard for XML is widely available for download.

To keep the information in the nodes and attributes honest, DTDs can be used to ensure data integrity. DTDs contain all of the validation information for an XML. Parsers are equipped with the ability to validate the XMLs data against the DTD. This will further ensure that the information is correct, and that there is no possibility of data corruption.

Data interchange is only the first step in uniting XML with your application development projects. XMLs can be used as configuration files for Java Servlets, or log files for applications and even translated into Web or phone-friendly applications.

The possibility for XML is limitless. It provides you with a mechanism for customization, which, in the past, was very difficult. It is now up to you to find a way to include the abilities of XML in your next application development project.

Mark Buchner is President and founder of Astech Technologies (Aurora, Ontario, Canada). Contact him at mbuchner@astech.com.