Inside XML

Inside XML

by Steven Holzner

View All Available Formats & Editions

The XML explosion hardly needs any introduction-it's everywhere and there just seems to be no end to what can be done with XML. While writing to the W3C standards, and keeping up with the pace for corporate implementation, you, the programmer or web developer, will need a comprehensive guide to get you started and show you what XML and its related technologies can


The XML explosion hardly needs any introduction-it's everywhere and there just seems to be no end to what can be done with XML. While writing to the W3C standards, and keeping up with the pace for corporate implementation, you, the programmer or web developer, will need a comprehensive guide to get you started and show you what XML and its related technologies can do. A thorough guide is imperative to success because you will need to know and understand the full scope of XML from day one in order to work with it successfully. With your time constraints and impossible project schedules, you need a comprehensive guide that fulfills your needs in one complete book. Inside XML is an anchor book that covers both the Microsoft and non-Microsoft approach to XML programming. It covers in detail the hot aspects of XML; such as, DTD's vs. XML Schemas, CSS, XSL, XSLT, Xlinks, Xpointers, XHTML, RDF, CDF, parsing XML in Perl and Java, and much more.

Product Details

Pearson Education
Publication date:
Inside Series
Edition description:
Older Edition
Product dimensions:
7.29(w) x 9.10(h) x 2.28(d)

Read an Excerpt

Chapter 10: Understanding Java

Chapter 7, "Handling XML Documents with JavaScript," and Chapter 8, "XML and Data Binding," describe how to work with XML and JavaScript in Internet Explorer. However, JavaScript is a relatively lightweight language, and most serious XML programming doesn't take place in browsers such as Internet Explorer. Today, the most common way of handling XML in code is to use Java. Working with XML by using Java has become a central XML topic, and no XML book can ignore this connection.

Java should not be confused with JavaScript; despite their names and similar syntax, they are not truly related. Java is a creation of Sun Microsystems and javaScript of Netscape. Java is far deeper and far more extensive than JavaScript.

On the other hand, now that we have used javaScript, we've got a good leg up on Java because much of the basic syntax is similar (because both are based on the C++ model, not because javaScript and Java are directly related). In the next two chapters, we'll see how to work with the most popular XML package written for Java-the XML for Java package from IBM's A1phaWorks.

In this chapter, we'll come up to speed with Java, building on what we already know of javaScript. We'll get the skills that we need for the next two chapters in this chapter, including creating Java classes and windowed applications.

In general, creating serious applications with Java is more involved than working with JavaScript because Java is so much more extensive. As you can imagine, there's way more Java than we can cover in one chapter, so if you want to learn more, pick up a good book on the subject. Try Special Edition Java 2 Platform by Joseph Weber, published by Que, or Sams Teach Yourself Java 2 in 24 Hours, 2nd Edition by Roger Candenhead, published by Sams. On the other hand, this chapter introduces all the Java coding skills we'll use in the next two chapters. If you're already comfortable with Java, feel free to skip to the next chapter, where I work with the XML DOM in Java (not JavaScript, as in Chapter 7).

Java Resources

Java is a product of Sun Microsystems. These are some Web sites that contain Java resources online, most of them at Sun:

  • Netscape's "Java Developer Central" site, which contains a good amount of useful information
  • main Java site; it's filled with information
  • documentation available online; this is the reference Web site.
  • The site for the current Java software development kit (this URL is very subject to change).
  • home of JavaVersion 1.3,which is the current version as of this writing (actually called Java 2 Platform, Standard Edition, version 1.3), of the Java software development kit
  • A great number of Java resources and discussions

Here's another list that you might want to look into; these are free online tutorials that you can use to develop your Java skills:

  •'s own, very extensive Java tutorial
  • Gamelan's Java tutorial
  • A good online Java tutorial
  • IBM's Java tutorial with some outstanding features

Here's an important note Java programming is not for everyone. Java is a complex language, and to cover it fully would take thousands of pages. We can't ignore it because it has come to play such a big part in the XML world, but if you're not into programming, you can skip the Java chapters (this and the next two chapters) and continue on with the rest of the book. Many people prefer to get their Java XML applications written by someone else, and that's fine. However, these days, to really work with XML, it usually comes down sooner or later to working with Java.

Writing Java Programs

You're probably already familiar with Java, if only because of Java applets. Applets-windowed Java applications designed to work in browsers-took the world by storm when first introduced, and all major browsers support some version of Java these days. You can find millions of applets on the Internet, and you can pick up whole banks of them for free. There are even applets out there that work with XML.

A Java applet takes up a predefined area in a browser and can display graphics, controls (such as buttons and text fields), text, and more. It's interactive because it runs in your browser. As mentioned, applets took the Internet by storm when first introduced. However, they're on the wane now, largely because of other solutions that can be easier to program, such as Dynamic HTML, or more powerful, such as Shockwave.

Don't worry about Java though-as applets have become less popular (although still very popular), Java applications have gathered strength. The main reason that Java applications have become so powerful is that they're nearly as powerful as C++, but they're also cross-platform-you can use the same application in Windows or UNIX, for example. Many large corporations have switched from using C++ internally to using Java for most programming.

A Java application does not run in a browser like an applet-it's a freestanding program. Java applications can themselves create windows, such as applets, and we'll see how to do that here. In fact, Java applications can act as browsers, and we'll see an example of that in the next chapter with a Java application that reads an XML document from the Internet and uses it to display graphics. In that case, the XML document will specify circles to draw, and we'll be creating a graphical, not text-based, browser, which is typical of the kinds of things you can do when you create your own XML applications...

Meet the Author

Steven Holzner (Cambridge, MA) is a former contributing editor for PC Magazine and has authored 50 books ranging in subject from assembly language to Visual C++. His books have sold over a million copies and have been translated into 15 languages. Holzner was on the faculty of Cornell University for 10 years, where he earned his Ph.D. and has also been on the faculty of his undergraduate school, Massachusetts Institute of Technology.

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >