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

Now that you have a basic understanding of what Quick does, you’re ready to learn how to use it. This section will cover conversion to and from XML using Quick and demonstrate the mapping features that it provides. Because Quick is a bit different from the other data binding frameworks, I recommend that you work through this section in order.

Unmarshalling

The first step in getting things going with Quick is to ensure you have a DTD on hand. That DTD will be the basis for generating some files that Quick needs in order to operate.

Warning

It is possible to use Quick by creating a Quick-specific data schema for modeling constraints directly. However, you can’t validate against this sort of schema, and you can’t exchange it with others who don’t know Quick. For that reason, it is always better to start with a DTD, which is universally understood, and use Quick’s tools to convert that DTD to Quick-specific formats.

Have Java classes on hand

Because the typical Quick processing cycle doesn’t involve generation of Java classes, you should have these classes available. Rather than take up a lot of space in this chapter, I’ve placed the source for a sample set of classes in Appendix B. You can type these in from the appendix or download them from the book’s web site at http://www.newInstance.com. In either case, you will want to compile them and make them available to your applications for conversion to and from Java.

Converting DTDs to QDML

Example 9-3 shows ...

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