失效链接处理 |
jaxb-2_0-fr-spec PDF 下载
本站整理下载:
相关截图:
主要内容:
1.1 Data binding
Any nontrivial application of XML will, then, be based upon one or more
schemas and will involve one or more programs that create, consume, and
manipulate documents whose syntax and semantics are governed by those
schemas. While it is certainly possible to write such programs using the lowlevel SAX parser API or the somewhat higher-level DOM parse-tree API, doing
so is not easy. The resulting code is also difficult to maintain as the schemas
evolve. While useful to some, many applications access and manipulate XML
content within a document; its document structure is less relevant.
It would be much easier to write XML-enabled programs if we could simply
map the components of an XML document to in-memory objects that represent,
in an obvious and useful way, the document’s intended meaning according to its
schema. Of what classes should these objects be instances? In some cases there
will be an obvious mapping from schema components to existing classes,
especially for common types such as String, Date, Vector, and so forth. In
general, however, classes specific to the schema being used will be required.
Classes specific to a schema may be derived or may already exist. In some
application scenarios e.g. web services, a data model composed using user
authored classes may already exist. A schema is derived from existing classes.
In-memory objects are instances of existing classes. In other application
scenarios, a data model is composed by authoring a schema. In such cases,
rather than burden developers with having to write classes specific to schema,
we can generate the classes directly from the schema. In all application
scenarios, we create a Java object-level binding of the schema.
But even applications manipulating documents at conceptual object level, may
desire to access or manipulate structural information in a document, e.g.
element names. Therefore, the ability for an application to relate between the
XML document representation and the Java object-level binding enables the use
of XML operations over the XML document representation, e.g. Xpath.to bind
XML content to an object model such as DOM is useful.
An XML data-binding facility therefore contains a schema compiler and a
schema generator. A schema compiler can consume a schema and generate
|