 |

Building A Wireless Architecture Using XML
by bryan morgan
If you are an information technology professional, you've found yourself hearing more and more about the eXtensible Markup Language, or XML, over the past few years. Based on the incredible success of the language when used as a bridge between disparate systems, there's even a good chance that you've used it already in your projects. Examples of situations where XML shines include data exchange between a brokerage house's account system and a stock exchange's order system or a relational database running on a Solaris server triggering a transaction against a hierarchical database running on an IBM mainframe. If you're new to the language, XML documents are built out of a set of tags, just as HTML documents are....but that's where the similarities end. While HTML includes a pre-defined set of tags that can not be extended in any way, XML allows the document to creator to define his/her own set of tags so that the document mirrors a real-world construct. This definition is stored in a file known as a Document Type Definition, or DTD. If someone wants to make sure that the XML they're exchanging with you complies with the definition you've created in the DTD, they can validate their document against your DTD using a validating XML parser.
XML has also been of interest to the wireless world over the past two years as it is the foundation of WAP's Wireless Markup Language (WML). In XML-speak, this means that WML itself is defined within a DTD. If you're curious, you can view the WML 1.1 DTD at http://www.wapforum.org/DTD/wml_1.1.xml. Not surprisingly, WAP and i-Mode will be transitioning to yet another XML-based language in the near future: XHTML, making it clear that XML is here in a big way and that it also is hear to stay.
While I've discussed XML applications such as data interchange and content display, XML is perhaps most critical - and effective - when used as the foundation for an application architecture that must support a wide variety of clients and display types...exactly the type of environment that wireless applications must work in. It is commonplace for a major online destination to support clients expecting HTML, WAP, i-Mode, Palm Query Applications, AvantGo, Text, SMS, Paging, or even XML content. If you are tasked with building an application to support two of these, it might make sense to build, for instance, a Java servlet solution that outputs HTML and another Java servlet solution that outputs WML. This would involve some entry point detecting the client type and then your embedding much or all of the HTML/WML code in two separate servlets for each piece of content you will be serving. Your code also queries a database and loops through some resultset to generate the HTML/WML content on-the-fly. This is a sloppy, but manageable solution for small applications - assuming your database never changes and you are never asked to extend the application.
What happens, though, if your management suddenly asks you to support three more types of content? Better yet, do you have a plan in place when your application/site grows until you are eventually generating hundreds or thousands of different pieces of content in all these different formats? One popular technique among experienced developers is to design a "middle-tier" layer on the server that retrieves data from one or more back-end sources then presents it to your application logic as XML. This insulates the bulk of your code from changes to the underlying data sources and allows you to make use of the power of XML and its sister technology, the Extensible Stylesheet Language, or XSL. XSL takes this "insulation" process one step further by allowing the display to be completely separated from the application logic (something near and dear to the heart of developers with object-oriented programming experience). XSL template files can be used to store the markup language-specific content (i.e. HTML, WML, etc.) and are "applied" to the XML using a piece of software known as an XSL processor (implementations are available for just about every common programming language in use today). Rest assured that XSL goes far beyond simple text substitution techniques. In fact, XSL supports the development of logic inside templates through the use of variables, conditional statements, and loops.
Should you choose to build an XML-based architecture, application server and database vendors are lining up to supply tools that will eliminate much of the coding required. For instance, while one could query an Oracle database then manually generate XML and apply a stylesheet, the Oracle XDK allows this process to be reduced to a few lines of code. Likewise, the popular BEA WebLogic Server includes support for XML messaging, XML/XSL processing, and a native XML parser implementation. Every vendor has thrown their whole-hearted support behind XML making it clear that it's a safe bet for your development processes moving forward.
Bryan Morgan is an independent writer and software developer. He is a columnist with Wireless Internet magazine and was the founder of WirelessDevNet.com in 1999.
|
 |