Java and XML Binding.pdf
(
2344 KB
)
Pobierz
154237222223154051095082227176186254241251021241050196083038089253153079010138025087051087044
Java and XML Data Binding
Brett McLaughlin
Publisher: O'Reilly
First Edition May 2002
ISBN: 0-596-00278-5, 214 pages
Table of Contents
Index
Full Description
Reviews
Reader reviews
Errata
This new title provides an in-depth technical look at XML Data Binding.
The book offers complete documentation of all features in both the Sun
Microsystems JAXB API and popular open source alternative
implementations (Enhydra Zeus, Exolabs Castor and Quick). It also gets
into significant detail about when data binding is appropriate to use, and
provides numerous practical examples of using data binding in
applications.
Copyright © 2002 O'Reilly & Associates, Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol,
CA 95472.
O'Reilly & Associates books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles (
safari.oreilly.com
)
. For
more information contact our corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com
.
Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered
trademarks of O'Reilly & Associates, Inc. Many of the designations used by
manufacturers and sellers to distinguish their products are claimed as trademarks. Where
those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps. The
association between the image of an osprey and the topic of Java and XML data binding
is a trademark of O'Reilly & Associates, Inc.
While every precaution has been taken in the preparation of this book, the publisher and
author(s) assume no responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein.
2
Table of Content
Table of Content ............................................................................................................. 3
Preface............................................................................................................................. 5
Organization................................................................................................................ 6
Conventions Used in This Book ................................................................................. 8
Comments and Questions ........................................................................................... 8
Acknowledgments....................................................................................................... 9
Chapter 1. Introduction ................................................................................................. 10
1.1 Low-Level APIs.................................................................................................. 10
1.2 High-Level APIs ................................................................................................. 13
1.3 What Is Data Binding?........................................................................................ 16
1.4 What You'll Need................................................................................................ 18
Chapter 2. Theory and Concepts................................................................................... 21
2.1 Foundational APIs .............................................................................................. 21
2.2 Dependent APIs .................................................................................................. 26
2.3 Constraint-Modeled Data.................................................................................... 28
2.4 API Transparence................................................................................................ 33
Chapter 3. Generating Classes ...................................................................................... 37
3.1 Process Flow ....................................................................................................... 37
3.2 Creating the Constraints...................................................................................... 40
3.3 Binding Schema Basics....................................................................................... 46
3.4 Generating Java Source Files.............................................................................. 50
Chapter 4. Unmarshalling ............................................................................................. 55
4.1 Process Flow ....................................................................................................... 55
4.2 Creating the XML ............................................................................................... 59
4.3 Converting to Java .............................................................................................. 64
4.4 Using the Results ................................................................................................ 68
Chapter 5. Marshalling.................................................................................................. 79
5.1 Process Flow ....................................................................................................... 79
5.2 Validating Java Objects ...................................................................................... 81
5.3 Converting to XML............................................................................................. 88
5.4 Process Loops ..................................................................................................... 98
Chapter 6. Binding Schemas....................................................................................... 101
6.1 The Basics ......................................................................................................... 101
6.2 Structure and Global Options............................................................................ 103
6.3 Elements and Attributes .................................................................................... 105
6.4 And More... ....................................................................................................... 114
Chapter 7. Zeus ........................................................................................................... 124
7.1 Process Flow ..................................................................................................... 124
7.2 Installation and Setup........................................................................................ 126
7.3 Class Generation ............................................................................................... 127
7.4 Unmarshalling and Marshalling........................................................................ 131
7.5 Additional Features........................................................................................... 139
3
Chapter 8. Castor ........................................................................................................ 143
8.1 Process Flow ..................................................................................................... 143
8.2 Installation and Setup........................................................................................ 144
8.3 Class Generation ............................................................................................... 145
8.4 Unmarshalling and Marshalling........................................................................ 149
8.5 Additional Features........................................................................................... 161
Chapter 9. Quick ......................................................................................................... 166
9.1 Process Flow ..................................................................................................... 166
9.2 Installation and Setup........................................................................................ 170
9.3 Unmarshalling and Marshalling........................................................................ 170
9.4 Additional Features........................................................................................... 183
Chapter 10. Looking Forward..................................................................................... 185
10.1 JAXB............................................................................................................... 185
10.2 Alternate Implementations.............................................................................. 186
10.3 J2EE ................................................................................................................ 188
Appendix A. Tools Reference..................................................................................... 191
A.1 JAXB................................................................................................................ 191
A.2 Zeus .................................................................................................................. 191
A.3 Castor ............................................................................................................... 192
A.4 Quick ................................................................................................................ 193
Appendix B. Quick Source Files ................................................................................ 196
Colophon..................................................................................................................... 199
4
54237222223154051095082227176186254241250143239137210252117074104060119172099042079097244175
Preface
XML data binding. Yes, it's yet another Java and XML API. Haven't we seen enough of
this by now? If you don't like SAX or DOM, you can use JDOM or dom4j. If they don't
suit you, SOAP and WSDL provide some neat features. But then there is JAXP, JAXR,
and XML-RPC. If you just can't get the swing of those, perhaps RSS, portlets, Cocoon,
Barracuda, XMLC, or JSP with XML-based tag libraries is the way to go.
The point of that ridiculous opening is that you, as a developer, should expect some
justification for buying yet another XML book, on yet another XML API. The market
seems flooded with books like this, and the torrent has yet to slow down. And while I
realize that I use circular reasoning when insisting that this API is important (I did write
this book on it), that's just what I'm going to do.
XML data binding has taken the XML world by storm. Thousands of programmers
simply threw up their hands trying to track SAX, DOM, JDOM, dom4J, JAXP, and the
rest. It's become increasingly difficult to parse a silly little XML document, rather than
increasingly simple. If it's not namespaces that get you, it's whitespace. Is that carriage
return after my element name significant? Well, it depends on whether you specify a
DTD; oh, you used an XML Schema? Well, we don't support that yet. I'm sure you know
exactly what I'm talking about.
The reason why XML data binding is important, and so remarkably different from other
approaches, is because it gets you from XML to business data with no stops in between.
You don't have to deal with angle brackets, entity references, or namespaces. A data
binding framework converts from XML to data, without your messing around under the
hood. For most developers who try to get into XML without spending months doing it,
data binding is just the answer you are looking for.
This book covers data binding from front to back, giving you the ins and outs of what
may turn out to be the API that makes XML accessible to even the newest programmers.
You'll learn how to perform basic conversions from Java to XML, all the way to using
various frameworks for advanced transformations and mappings. It's all in this (nicely
compact) book, without lots of wasted words and frilly examples. If you want to use data
binding, this book is for you. If you don't, well, put it down and go pick up about ten
other books so you can manipulate XML some other way. I think the choice is obvious;
so get started!
154237222223154051095082227176186254241250143239137210252117074104060119172099043170090101072
5
Plik z chomika:
Mateusssz
Inne pliki z tego folderu:
Excel 2010 Formulas.pdf
(21883 KB)
Beginning XML with DOM and Ajax.pdf
(9282 KB)
AJAX and PHP - Building Responsive Web Applications.pdf
(5712 KB)
Advanced Ajax - Architecture and Best Practices.pdf
(5005 KB)
Professional PHP Programming.pdf
(18286 KB)
Inne foldery tego chomika:
Biologia
Chemia
Komiksy
Nauka klawiszy
Zgłoś jeśli
naruszono regulamin