XML and Java: A potent partnership, Part 2

Learn how to use Java to build applications that handle XML's extensibility

1 2 Page 2
Page 2 of 2
  1. Download the above files

  2. Add both howto.jar and xml4j.jar to your CLASSPATH

  3. From the command line, type: java Main test.xml

The application will read the specified XML file, parse and validate it, dynamically load and create the necessary hooks, and create the user interface.

Conclusion

When it comes to dynamically extending an application, Java's ability to dynamically load classes is quite a boon. It makes frameworks like the one I presented above possible and truly expands the potential of a language like XML. Based on the framework and the sample application I presented, you can see how easy it would be to use XML as a scripted user interface definition language, or as the basis for a configuration tool, or any of a number of other possibilities. If you come up with a novel application, write me and tell me about it.

Next month, I'll continue my exploration of the compatibility of XML and Java. I'll demonstrate how to integrate a scripting language into the framework we've created and how to dynamically modify the DOM tree itself.

Todd Sundsted has been writing programs since computers became available in convenient desktop models. Though originally interested in building distributed object applications in C++, Todd moved on to the Java programming language when it became the obvious choice for that sort of thing. In addition to writing, Todd is an architect with ComFrame Software Corporation.

Learn more about this topic

  • Related reading

1 2 Page 2
Page 2 of 2