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> ...
Get Java & XML Data Binding now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.