Java.next -- Four languages that represent the future of Java
Blogger Stuart Halloway has begun a series of posts on trends that point to the future of the Java platform. In his first post, he compares Clojure, Groovy, JRuby, and Scala -- four wildly different languages that nonetheless all play together in the JRE. Find out what unites these languages and what they can tell us about the future of Java-based development ...

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

XML and Java: A powerful combination

Why JavaOne's session on 'XML in the Java Platform' drew the crowds

XML was a well-received new specification when it was first introduced by the World Wide Web Consortium (W3C) in November 1996; now, combining it intrinsically with Java -- that is, making XML-specified code part of a Java program as well as encoding Java semantics (or behavior) into XML markup -- promises to deliver easier and more innovative application computing to the enterprise and beyond. According to Larry Cable and Mark Reinhold, senior staff engineers at Sun and presenters of the "XML in the Java Platform" technical session at the recent JavaOne Developer Conference, the main reason to pay attention to this technological marriage is that XML-based syntax offers a flexible, standard, and robust solution for Java programming, and, conversely, Java applies a universal set of semantics to XML data.

Why XML?

Most information available in the electronic world isn't stored or presented in images, 3D graphics, movies, sound, or any other impressive multimedia format. It exists, instead, in the form of character-based text -- on the Web, in databases, and elsewhere -- and text is most likely here to stay. XML allows developers to contextualize and interpret their data within a standard structure, so that one set of XML-framed data can be combined with another without rebuilding the entire structure with each new addition or modification.

How Java fits into the picture

XML provides a universal syntax for Java semantics (behavior). Simply put, this means that a developer can create descriptions for different types of data to make the data behave in various ways with Java programming code, and can later repeatedly use and modify those descriptions. Since XML and Java are both portable standards, the result of using the combination of the two technologies is portable, reusable data and portable behavior.

The full potential of what one can achieve with either XML or Java alone hasn't been fully tapped yet; to combine the two is to enter largely uncharted territory. Right now, the two main application areas of XML in Java are presentation-oriented publishing and enterprise message-oriented middleware. Specifically, XML can be combined with Java to produce such applications as complex Web documents, dynamic publishing, e-commerce, enterprise application integration, and structured information management and retrieval.

The XML standard extension

The XML standard extension is the basic plumbing that translates XML syntax into Java. The technical and structural details of the plumbing are still being hashed out, but at the end of 1999 Java developers will be able to use the standard extension to build XML-oriented applications. The standard extension involves a number of components: a parser, namespace support in the parser, the simple API for XML (SAX), and the document object model (DOM).

A parser is a software module that parses, or reads the data of, an XML document and checks it for validity. A namespace, part of the W3C XML specification, defines a distinct set of XML markup elements within a document type definition (DTD). The major benefit of a namespace is that it allows multiple vocabularies -- different sets of markup that behave in different ways -- to be combined in a single document instance. Obviously, to exploit this benefit, a parser must support namespaces. Sun Microsystems is still working on this support.

Resources