XML and Java: Why These Two
November 16, 1998
New Java software targeted for use with XML appears
every month. What is it about XML and Java that make
them such a good match? On the surface it may be hard to
see the fit, since the two seem to be very different.
After all, XML is a markup language, while Java is a
programming language. XML is a standard promoted by the
World Wide Web Consortium (a large
group
of nearly 300 companies, universities, and government agencies
with diverse interests), whereas Java is essentially a de
facto standard controlled by a single software and hardware company,
Sun Microsystems.
Many web developers have come to the conclusion that XML
and Java are the perfect pair because they complement each
other so well. XML contributes platform-independent
data -- portable documents and data. Java contributes
platform-independent processing -- portable object oriented
software solutions. In the primordial XML days of March 1997,
Sun Microsystem's Jon Bosak [1]
wrote in his seminal article,
XML, Java, and the Future of the Web,
that: "XML gives Java something to do". That is, XML
provides the data for Java to process in several specialized
application areas:
"The applications that will drive the acceptance of
XML are those that cannot be accomplished within the limitations
of HTML. These applications can be divided into four broad
categories:
- Applications that require the Web client to mediate
between two or more heterogeneous databases.
- Applications that attempt to distribute a significant
proportion of the processing load from the Web server to
the Web client.
- Applications that require the Web client to present
different views of the same data to different users.
- Applications in which intelligent Web agents attempt
to tailor information discovery to the needs of individual
users."
The applications that Bosak referred to over a year and
a half ago are finally beginning to appear, thanks to the
combination of XML and Java. Bosak recently wrote an article
for IEEE Computer entitled
"Media-Independent Publishing: Four Myths about XML".
In that October 1998 article, Bosak gave us another quotable
gem: "XML can do for data what Java has done
for programs, which is to make the data both platform-independent
and vendor-independent."
Both XML and Java are Internet friendly. XML was designed
to be an optimized, flexible, readable format which is
straightforward to use over the Internet; Java has been
network-aware from the beginning in its support of sockets,
HTTP, HTML, and servers. Both support Unicode (two byte
characters) and therefore contribute to internationalized
applications [2]. Much as Java provides
programmers the ability to represent complicated data structures
and object-oriented models (sometimes in a tree or table view),
XML is ideal for representing complex, hierarchical data models.
While Java developers have benefited from a rich development
environment for several years, XML proponents are more recently
experiencing the widespread availability of tools to support
their ability to write applications that process XML documents.
(Some may argue that truly mature XML authoring tools have
not yet arrived. No argument here.)
Although there are many XML tools and libraries based on other
languages such as Python, perl, and C, the majority of XML
development is focused on Java, which is emerging as the
language of choice for processing XML. In mid September
1998, JavaSoft posted its first Early Access release of the
XML Library (discussed in detail in Part 2 of this article),
indicating Sun's interest in providing a standard interface
to XML from Java. It is unclear whether this will eventually
become one of the Core packages of the
Java Development Kit (JDK),
but this seems like a highly desirable scenario. Why? Well, if
JavaSoft
includes the XML Library in a future JDK, then any browser
that supports the corresponding Java Virtual Machine (JVM)
will by definition contain full and identical support for XML
processing. Developers would not have to download generic XML
code with their applets or applications. On the other hand,
Sun may choose not to include the XML Library in JDK to keep
the size of JDK smaller (but not by much). [3]
Part 1 concludes with a discussion of terminology which
is fundamental to the discussion of using XML with Java.
Parts 2 and 3 of this article will present a survey of all
significant Java/XML efforts. Readers who know of others are
encouraged to submit them to
the author for
consideration in subsequent updates. Those interested in XML
software in languages in addition to Java are directed to our
earlier article, the
XML Software Guide,
which, like this article, is also updated periodically.
[1] Bosak, considered by some to be the
inventor of XML (along with Textuality's Tim Bray and
Microsoft's Jean Paoli) became the chairperson
of an SGML effort that evolved into the
XML Working Group
of the W3C.
[2] Internationalization is often abbreviated
as "i18n", with the 18 signifying the number of
letters between the "i" and the "n", as
many X Window System developers may recall.
[3] If you're interested in encouraging
Sun to add the XML Library, please consider joining the
Web Standards Project.
XML and Java: The Perfect Pair: Part 1
XML and Java: The Perfect Pair: Part 1
XML and Java: Definitions
|