|
|
The Java Web Services Tutorial |
Architectural Overview Figure 1-1 shows the components that make up a JAXB implementation. Figure 1-1 JAXB Architectural Overview As shown in Figure 1-1, a JAXB implementation comprises the following eight core components. Table 1-1 Core Components in a JAXB Implementation Component | Description | XML Schema | An
XML schema uses XML syntax to describe the relationships among
elements, attributes and entities in an XML document. The purpose of an
XML schema is to define a class of XML documents that must adhere to a
particular set of structural rules and data constraints. For example,
you may want to define separate schemas for chapter-oriented books, for
an online purchase order system, or for a personnel database. In the
context of JAXB, an XML document containing data that is constrained by
an XML schema is referred to as a document instance, and the structure and data within a document instance is referred to as a content tree. | Binding Customizations | By
default, the JAXB binding compiler binds Java classes and packages to a
source XML schema based on rules defined in Section 5, "Binding XML
Schema to Java Representations," in the JAXB Specification.
In most cases, the default binding rules are sufficient to generate a
robust set of schema-derived classes from a wide range of schemas.
There may be times, however, when the default binding rules are not
sufficient for your needs. JAXB supports customizations and overrides
to the default binding rules by means of binding customizations
made either inline as annotations in a source schema, or as statements
in an external binding customization file that is passed to the JAXB
binding compiler. Note that custom JAXB binding customizations also
allow you to customize your generated JAXB classes beyond the
XML-specific constraints in an XML schema to include Java-specific
refinements such as class and package name mappings. | Binding Compiler | The
JAXB binding compiler is the core of the JAXB processing model. Its
function is to transform, or bind, a source XML schema to a set of JAXB
content classes in the Java programming
language. Basically, you run the JAXB binding compiler using an XML
schema (optionally with custom binding declarations) as input, and the
binding compiler generates Java classes that map to constraints in the
source XML schema. | Implementation of javax.xml.bind | The
JAXB binding framework implementation is a runtime API that provides
interfaces for unmarshalling, marshalling, and validating XML content
in a Java application. The binding framework comprises interfaces in
the javax.xml.bind package. | Schema-Derived Classes | These
are the schema-derived classes generated by the binding JAXB compiler.
The specific classes will vary depending on the input schema. | Java Application | In
the context of JAXB, a Java application is a client application that
uses the JAXB binding framework to unmarshal XML data, validate and
modify Java content objects, and marshal Java content back to XML data.
Typically, the JAXB binding framework is wrapped in a larger Java
application that may provide UI features, XML transformation functions,
data processing, or whatever else is desired. | XML Input Documents | XML
content that is unmarshalled as input to the JAXB binding framework --
that is, an XML instance document, from which a Java representation in
the form of a content tree is generated. In practice, the term
"document" may not have the conventional meaning, as an XML instance
document does not have to be a completely formed, selfstanding document
file; it can instead take the form of streams of data passed between
applications, or of sets of database fields, or of XML infosets, in which blocks of information contain just enough information to describe where they fit in the schema structure. In JAXB, the unmarshalling process supports validation
of the XML input document against the constraints defined in the source
schema. This validation process is optional, however, and there may be
cases in which you know by other means that an input document is valid
and so you may choose for performance reasons to skip validation during
unmarshalling. In any case, validation before (by means of a
third-party application) or during unmarshalling is important, because
it assures that an XML document generated during marshalling will also
be valid with respect to the source schema. Validation is discussed
more later in this chapter. | XML Output Documents | XML
content that is marshalled out to an XML document. In JAXB, marshalling
involves parsing an XML content object tree and writing out an XML
document that is an accurate representation of the original XML
document, and is valid with respect the source schema. JAXB can marshal
XML data to XML documents, SAX content handlers, and DOM nodes. | Download
|
|
|
Additional
Info |
|
|
No.
|
230 |
Posted
on |
8 June, 2006 |
|
|
|
|
|
|