Why Should I Use XML?

Why have vendors like Oracle, IBM, Microsoft, Sun, SAP, and many others moved so fast to support XML? After all, these companies have worked for many years to fine-tune the efficiency of their proprietary data formats and tools. The reason is simple: as a vendor-neutral, platform-neutral, language-neutral technology for web-based data exchange, the XML family of standards solves a key problem for these companies’ customers. In a nutshell, XML simplifies the task of connecting applications and services over the Web.

XML Enables a Data Web of Information Services

Proprietary data formats undoubtedly represent data in a more efficient way, but what XML sacrifices in compactness, it gains many times over in flexibility. If you can publish an XML datagram on the “wire,” anyone connected to the Internet can receive the datagram, parse it, manipulate it, search it, and transform it using a wide selection of freely available tools that implement the XML family of standards. Skeptics who dwell on XML’s apparent inefficiencies (“It’s more tags than data, for heaven’s sake!,” they say), haven’t yet understood how its usefulness grows when it is combined with the Internet’s universal reach. The HTML standard and the essentially free cost of HTML-savvy browsers sparked the creation of the Web as we know it today: a sea of information available 24 hours a day for a pair of human eyeballs focused on a browser to exploit. The XML family of standards and the low cost of many XML-savvy tools have already begun to spark an analogous “data web” of Internet-based machine-to-machine information exchanges. XML is on track to have an even greater impact on the computing landscape than HTML has had.

Critics are correct to point out that XML is no magic bullet, noting that companies still need to agree on common XML vocabularies for application data exchange. However, market forces are already quickly resolving these concerns. Due to the tremendous opportunities presented by business-to-business e-commerce, a burgeoning sector whose key players are already leveraging this new XML-based data web, the number of XML-based standards for domain-specific business messages is growing exponentially. By tapping into the XML data web, you can save money by leveraging outsourced business content and services, and generate new revenue by publishing slices of your own valuable data as web services to be “consumed” by other partners.

XML Simplifies Application Integration

It is not uncommon for a company to have:

  • Machines running operating systems from Sun, HP, IBM, Microsoft, and others

  • Databases from Oracle, IBM, Microsoft, and others

  • Packaged applications from Oracle, SAP, and others

An XML-based representation of data and the HTTP protocol might be the only things these various systems can ever hope to have in common! More and more, these systems must be integrated over the Internet and across firewalls, so XML over HTTP or secure HTTPS is the data exchange mechanism of choice to connect these heterogeneous applications.

Figure 1.9 illustrates a sample architecture for XML-based application integration. It shows how an SAP system using a Microsoft SQL Server database sends an XML datagram over the Web to a server that acts as a message hub. The hub server routes the datagram to a particular target application, say an Oracle Applications installation using an Oracle8i database. In doing this, it may need to transform the incoming XML datagram into an appropriate XML vocabulary for the target application before sending the datagram to its destination.

XML and HTTP can connect different applications

Figure 1-9. XML and HTTP can connect different applications

Adopting an architecture like this does not require invasive, dramatic changes to existing systems. Data in the SAP and Oracle Applications systems is still stored in its original relational tables, exactly as it was before the integration. The XML datagram is materialized from information in the source system by dynamically generating an XML document. Upon arrival at the target system, the datagram is parsed, searched, and programmatically manipulated to enable appropriate information from the datagram to be inserted into the target application’s database. While SAP and Oracle Applications use completely different database schemas to support their respective application suites, these physical storage details are not a roadblock to integration when the two systems communicate using XML datagrams.

XML Simplifies Information Publishing and Reuse

The same strengths that make XML good for application integration also deliver benefits to other areas of application development. Leveraging the dynamic duo of XML (to represent rich data structures independent of presentation details) and XSLT (to transform the data into any other XML, HTML, or text-based output format), you can easily:

  • Separate data from presentation, allowing you to change the look of the information without affecting application code

  • Publish the same data using output styles specific to each kind of requesting device: browser, cell phone, PDA, another computer, etc.

With the exploding number of web-enabled devices and the increasing number of XML-based standards emerging, the ability to assemble information from multiple sources and transform it for delivery into any format required by the target device is extremely valuable.

As any database-savvy developer knows, SQL is a highly effective tool for finding, filtering, shaping, and summarizing the data required by any application task. Using XML to publish SQL-based query results packs an even stronger punch, making the information in the query results easy to transform, transport, and transcribe. Figure 1.10 shows the high-level architecture for the combination of SQL, XML, and XSLT. By representing SQL query results as XML, we can assemble a "data page” from multiple queries and external XML information sources. Then we can use XSLT to transform this assembled XML data page into any desired output format (like HTML) for presentation in a browser or any of a number of XML-based formats, such as:


The Wireless Markup Language, for cell phones and PDAs


The Scalable Vector Graphics language, for rendering rich, data-driven images

XSL Formatting Objects

For high-quality printed output

Assembling and transforming XML “data pages”

Figure 1-10. Assembling and transforming XML “data pages”

Publishing XML datagrams from relational databases and storing the information from XML datagrams you receive in the database as tables and columns offer you the best of both worlds. You retain the proven scalability, reliability, manageability, and performance of today’s mature relational databases and the tools and applications that work with them. You also gain the newfound ability to exchange information with anyone, anywhere over the Web. As we will see throughout this book, the combination of SQL, XML, and XSLT is powerful stuff.

Get Building Oracle XML Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.