 | Level: Intermediate Nicholas Chase (nicholas@nicholaschase.com), Author, Studio B
28 Oct 2003 Using a DOM NodeFilter lets you control the contents of a set of XML data without touching the base application, but the NodeFilter itself is still a class, and needs to be recompiled in order to make any non-trivial changes. This tutorial explains how to build a system that enables a user to control both the criteria for a report and the structure of that criteria simply by providing XML input, either through a file or through a web service, using XML Data Binding.
Prerequisites
This tutorial is for developers who would like to create a system that allows maximum flexibility in data reporting without complex programming. It discusses the creation of a system that uses XML data binding to create an object that represents the criteria for a report. The object itself can be populated by a user-supplied XML file, making both the criteria and its structure completely flexible. This tutorial assumes that you are familiar with XML and XML schemas. It also assumes that you are familiar with Java technology, but no GUI programming is required. It also uses a small amount of HTML, but an in-depth understanding of HTML is not crucial.
System requirements
You'll need JavaScript enabled in your browser. This tutorial describes the creation of a Java application that provides a report in the form of a servlet. To follow along, you need the following components:
-
A Java development environment: At a minimum, you need a JDK such as J2SE 1.3 or above from Sun Microsystems. Version 1.4.2 is available at http://java.sun.com/j2se/1.4.2/download.htm.
-
The ability to compile and run Java applications: The easiest way to get the additional tools necessary is to use IBM's WebSphere Studio Application Developer (WSAD), which includes a development environment and a test servlet engine. Get WSAD from http://www-3.ibm.com/software/awdtools/studioappdev/. You can, of course, use a plain text editor and the tools that come with J2SE, but that creates a lot of extra work for yourself.
-
Servlet support: If you use WSAD, you already have all that you need. If, on the other hand, you prefer to use something else, you can download the Tomcat servlet engine from http://jakarta.apache.org/tomcat/index.html.
-
XML support: Whether you use WSAD orJ2SE 1.3, you need to download an XML parser. This tutorial uses the Xerces parser from the Apache project, which you can download at http://xml.apache.org/xerces2-j/index.html.
-
Data binding support: This tutorial uses the Castor XML data binding engine, download it from http://www.castor.org. You can also use the JAXB engine, downloadable at http://java.sun.com/webservices/webservicespack.html, but class names and mappings are different.
Duration
Under two hours
Formats html, pdf
|  | |  |