Architecture & DesignThe Role of XML in Agile Enterprise Architecture

The Role of XML in Agile Enterprise Architecture

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

(Is XML Really Boring?)

Recently, I attended a talk about ‘Agile Enterprise Architecture’ by a well-known author and speaker. It was an inspiring talk that discussed agile tools, methods, and processes. During the question and answer period, I posed a question: “What role does XML play in agile enterprise architecture?” The answer floored me: “Quite frankly, I think that XML is boring” was the author’s curt reply.

I was so taken aback that I didn’t know how to respond at the time. I thought I was asking a leading question. I was expecting to hear that XML has become pervasive in enterprise architecture in a few short years and that it has tremendously improved agility (the modifiability, portability, reusability, integrability, and testability of software[i]).

Is XML really boring?What is its place in agile enterprise architecture?

We’ll begin our exploration with a brief background on XML. Next, we’ll discuss the virtues of XML. Then we’ll move on to the technologies that comprise and have been inspired by XML. We’ll discuss the tiers used to describe enterprise architecture and how XML and XML technologies are used in each tier. Then we’ll summarize XML’s role in agile enterprise architecture.

XML Background

XML was introduced a few short years ago, in 1997. It is a descendant of SGML (Standard Generalized Markup Language), which is a language for describing markup languages, particularly those used in electronic document exchange, document management, and document publishing. XML is a cousin markup language of HTML that has also made a meteoric rise in popularity and usage.

Virtues of XML

Why has XML become so pervasive since 1997? Perhaps the many virtues of XML explain why.

XML is Simple

XML represents data through a hierarchical tree structure of elements. Elements are composed of data, attributes, and other elements. A tag is the markup language used to describe an element. An XML tag is represented by the element name enclosed by angle brackets.

An XML document can be used to store simple structured data as well as complex or even unstructured data. The rules for constructing an XML document are simple. A well-formed document can be easily parsed into elements, attributes, and data.

XML separates data from presentation

Unlike other markup languages that embed data within presentation components, XML separates data from presentation. For example, in HTML, the following might represent customer data laid out in a tabular format:

<table>
  <tr>
    <td>ABC Pizza</td>
    <td>Simsbury</td>
    <td>CT</td>
    <td>06070</td>
  </tr>
</table>

HTML tables or <table> elements describe a tabular structure of rows and columns. Table row or <tr> elements contain a row of data. Table data or <td> elements contain data values. HTML describes the presentation characteristics, in this case a tabular layout. It describes the presentation, and contains the data values, but does a poor job of describing the data for other uses.

In XML a customer might be represented as follows:

<Customer>
  <Name>ABC Pizza</Name>
  <City>Simsbury</City>
  <State>CT</State>
  <Zip>06070</Zip>
</Customer>

XML concentrates solely on describing the data. This data could be rendered in a multitude of presentation formats, unlike the HTML table shown above.

XML is self describing

XML comes with no pre-defined vocabulary or schema, unlike other markup languages. It can be used to describe virtually any data structure. Its tags, as in our customer example, describe the data.

XML is adaptive

New data elements can be easily added to our customer XML document, as shown in bold in the following example:

<Customer>
  <Name>ABC Pizza</Name>
  <City>Simsbury</City>
  <State>CT</State>
  <Zip>06070</Zip>
  <Email>contactus@pizza.com</Email>
  <Website>http://www.pizza.com</Website>
</Customer>

Existing clients would not be affected by the addition of the Email and Website elements. Generally, clients are agnostic to added data elements.

XML is interoperable

XML is a text-based data format that can easily be parsed and understood by heterogeneous hardware and software platforms. For example, an XML document can be used to communicate data between J2EE and .NET.

XML is standards-based

XML and many XML-inspired technologies are based upon industry standard specifications. There are many competing implementations of the various XML standards. There are also many proprietary XML technologies aspiring to become standards.

Technologies Inspired by XML

Let’s take a look at a few of the standard technologies that comprise and were inspired by XML.

DTD (Document Type Definition) and XML Schema describe the structure, content, and semantics of XML documents. Many standard XML vocabularies have emerged using DTD and XML Schema. SOAP (Simple Object Access Protocol) and WSDL (Web Services Definition Language) are examples of XML vocabularies used in Web Services. ACORD XML is an example of a standard industry-specific vocabulary.

In order to parse XML documents, several approaches have been standardized: DOM (Document Object Model) is an API that provides an object representation of an XML document and can be used to both to query and manipulate documents; SAX (Simple API for XML) is a push-based API for parsing XML documents as a stream of events; StAX (Streaming API for XML) is a new standard pull-based parsing API. These API are implemented by various languages and vendors.

XPath is the query language for XML and plays the same role that SQL does for relational data. XPath is a building block for several other XML-inspired technologies, such as XSLT (eXtensible Stylesheet Language for Transformations), a language for transforming XML documents into other formats and XQuery, a language for querying XML documents from a broad spectrum of XML datasources.

XForms is a platform-independent markup language for data capture and validation. It provides an XML-friendly means of data capture. XForms improves upon HTML forms by separating presentation and content.

These are but a few of the technologies that exploit the virtues of XML.

Enterprise Architecture Tiers

For a moment, let’s pause our discussion of XML and XML-inspired technologies and discuss a typical tier structure for describing enterprise architecture. Then, we’ll see how XML maps into the enterprise tiers.

Typical enterprise architecture can be categorized into the following tiers: Client Tier, Presentation Tier, Service Tier, and Resource Tier. Configuration is not a tier per se, but permeates all tiers.

Client tier

The client tier includes thin, browser-based user interfaces and thick, rich client user interfaces.

Presentation tier

The presentation tier services the client tier. In the case of a browser-based interface, the presentation tier serves up markup pages and other resources to the client tier. Typically, this tier would be built upon a MVC (model-view-controller) framework to separate the business model (data and business logic), view (presentation code), and controller (response to user actions).

Service tier

The service tier hosts business and technical services. Services expose components through a common interface and are accessible from many clients, including the presentation tier. Typically, this tier would implement a SOA (Service Oriented Architecture) framework and include the ability to produce, consume, deploy, and manage services.

Resource tier

The resource tier includes the back-end systems of record, which may include mainframe systems, vendor packages, databases, and external resources. Resources are exposed to various clients via the service tier.

Configuration

Configuration is not really a tier per se; at least not yet. However, intra-component, intra-tier, and inter-application configuration is a reality of enterprise architecture. Applications, services, and components are becoming more and more configurable or data driven to improve their agility.

XML Usage in Each Tier

Now, we’ve covered a brief introduction to XML, its virtues, and resultant innovation. We’ve also covered a typical tier structure for describing enterprise architecture. Let’s see how XML and XML technologies map to the enterprise tiers.

Inter-tier communication

One of the initial uses of XML was to communicate messages between tiers. It didn’t matter that tiers may reside on different hardware and software platforms. XML is portable between heterogeneous platforms because it is a standard, self-describing, text-based format. Once XML became prevalent in inter-tier communication, it began to be used intra-tier as well.

Client tier

XML’s cousin, HTML, has reigned in the client tier. While HTML may not be going away soon, it is changing, and how HTML is generated is changing as well.

XHTML is HTML that is also a well-formed XML document. It basically turns HTML into an XML vocabulary. Why is this significant? HTML was a bit too lax and forgiving, causing ambiguous markup code and browser compatibility issues. By being well-formed, XHTML improves upon HTML’s slackness. It can be parsed with standard XML parsers, queried by XPath, and even transformed via XSLT.

XSLT, a transformation language for rendering XML into other markup formats, makes it possible to render HTML directly on the client from an XML data source. This provides a clean separation from the data, represented in the XML document, and the presentation, represented in the generated HTML. CSS (Cascading Style Sheets) are another technology that can be used on the client to present XML documents in a browser and eliminate HTML altogether.

XForms is a maturing technology that has the potential to revolutionize user interface development. It also separates data from presentation and adds features lacking in HTML forms, such as strong typing, validation, reduced server trips, reduced need for scripting, and an XML representation of form instance data. It provides an XML-friendly manner of data capture.

Presentation tier

Because of browser compatibility issues with non-standard XSLT implementations, XSLT has also become prevalent in the presentation tier. Often, the view in a MVC framework is implemented in XSLT. In this approach, the stylesheet may be called from the controller to render an XHTML response to the client from an XML source document.

It is also becoming more common for the model in MVC to be implemented in XML. With this approach, XML documents might be held in session, accessed via DOM or XPath API, and wrapped by objects to add behavior and encapsulate the XML.

Service tier

Service-oriented architecture is not a new concept. However, it has gotten a shot in the arm from XML. Web Services—a recent implementation of SOA—owes a debt of gratitude to XML for enabling this technology to flourish and prosper. HTTP and XML have become the standard protocol and payload for sending and receiving messages with the service tier.

A typical service tier utilizes many XML vocabularies. WSDL (Web Services Definition Language) is a vocabulary for describing a service and its contract. SOAP (Simple Object Access Protocol) is a vocabulary for passing objects between components in a decentralized distributed environment. There are a plethora of industry standard vocabularies, such as ACORD XML in the insurance industry, used to describe the messages passed in a SOA.

To receive and send messages, the service tier uses XML parsing API such as DOM, SAX, and StAX. A service provides an interface to applications, components, and resources which themselves may have an XML-based API. Often, the service will use XSLT to transform requests and responses to and from these components as per the service contract.

Because the service payload is in XML, a service management tool usually has the capability to “mine” the request and response messages via XPath for relevant auditing, metering, billing, and traceability information.

Resource tier

Once XML became prevalent in other tiers, it naturally led to XML being persisted in the resource tier. All relational databases support XML storage in some way. XML databases have emerged as a specialized category of databases for storing XML documents. These databases excel at storing unstructured data, transient data, and configuration data. Because XML Schemas can often be changed without impacting clients, XML provides a very versatile and agile data structure.

Configuration

XML is becoming the de facto standard for storing configuration data. It has several advantages over other approaches. A single document can store complex data structures of related meta data elements in a cohesive manner. This document can be versioned in a configuration management tool. Document-oriented meta data can be made available to an application via an XML database, filesystem, or URI. It can be loaded in memory as a DOM and easily queried.

Summary

XML was born in 1997. Its elegant simplicity, cross-platform compatibility, and many other virtues have led to wide adoption. XML has inspired many technologies. In enterprise architecture, XML has become the standard for inter-tier communication. Within each tier, XML and XML-related technologies have become pervasive.

Why has XML made such an impact in such a short time? Software architectures utilizing XML and XML technologies are more maintainable, portable, reusable, integrable, and testable. XML has tremendously improved agility in enterprise architecture.

Is XML really boring? How people have used it is rather inspiring. How are you going to use XML and XML technologies to improve your agility today? The rest is up to you!

About the Author

Jeff Ryan is an architect for Hartford Financial Services. He has twenty years experience designing, developing and delivering automated solutions to business problems. His current focus is on Java, XML and Service Oriented Architecture. He may be reached at jryan@thehartford.com.
Other Articles Written by Jeff Ryan


[i] McGovern, Ambler, Stevens, Linn, Sharan, Jo; A Practical Guide to Enterprise Architecture, Prentice Hall, 2003, p.52

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories