O'Reilly logo

Java & XML Data Binding by Brett McLaughlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unmarshalling and Marshalling

Once you have a handle on how Zeus deals with class generation, the rest of the package is a piece of cake. Marshalling and unmarshalling in Zeus and JAXB are very similar. I’ll walk you quickly through the basics here, although this topic should seem familiar after Chapter 4 and Chapter 5.

Unmarshalling

With classes generated and compiled, you need to have an XML descriptor to unmarshal into these Java objects. Example 7-2 is such a descriptor.

Example 7-2. A sample descriptor

<?xml version="1.0" encoding="ISO8859_1"?> <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'> <web-app> <display-name>WebTier</display-name> <description>Web Tier DD for the PetStore application</description> <servlet> <servlet-name>accountcreationsuccess</servlet-name> <servlet-class>accountcreationsuccess</servlet-class> </servlet> <servlet> <servlet-name>banner</servlet-name> <servlet-class>banner</servlet-class> </servlet> <servlet> <servlet-name>cart</servlet-name> <servlet-class>cart</servlet-class> </servlet> <servlet> <servlet-name>webTierEntryPoint</servlet-name> <display-name>centralServlet</display-name> <description>no description</description> <servlet-class> com.sun.j2ee.blueprints.petstore.control.web.MainServlet </servlet-class> </servlet> <servlet> <servlet-name>populateServlet</servlet-name> <display-name>Populate Servlet</display-name> <description>no description</description> <servlet-class> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required