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

Constraint-Modeled Data

Once you’ve got a handle on the APIs involved with data binding (and those that could depend on it), you need to have a solid understanding of XML constraints. These constraints are one of the most important aspects of working with class generation (along with the binding schema), and your constraint model will dictate the classes that result. Good constraint modeling will result in efficient, business-oriented classes; however, poor modeling can result in hundreds of classes or convoluted names and methods.

One thing I do want to mention before diving into this section and the rest of the book is that I expect you to know the basics of DTDs and XML Schema. When I cover alternatives like Relax NG, I’ll include some basic explanations related to the examples, but I don’t want to spend time covering syntax of DTDs and schemas. There are plenty of available books on the subject, so you may want to have one or more of these handy as you work through the examples. I’m also going to assume that you can pick up some skills by following along with the examples; in other words, I’m not going to spend a lot of time talking about constraint basics, except those that relate specifically to data binding. Hopefully seeing lots of DTDs and schemas in this book will make you examine how you write your own constraints and pick up some good ideas. That said, let me dive into specific constraint models and what to watch for when writing constraints for use in data binding ...

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