The Java Architecture For XML Binding (JAXB) By: Yoav Zibin Sharon Krisher.
Object-oriented tools for XML Schema JAXB (Java Architecture for XML Binding) –object connectivity...
-
Upload
rolf-lloyd -
Category
Documents
-
view
221 -
download
2
Transcript of Object-oriented tools for XML Schema JAXB (Java Architecture for XML Binding) –object connectivity...
Object-oriented tools for XML Schema
• JAXB (Java Architecture for XML Binding)– object connectivity for XML documents
• HyperJAXB– relational persistence for XML data
• jaxb-verification– object-level validation
JAXB
• Generates content classes based on the XML Schema
• Provides XML/objects exchange infrastructure– XML documents may be automatically
unmarshalled into object structures – Object structures may be automatically
serialized into XML
JAXB - Example
// Load metadata object structure
// from the XML document
Metadata metadata =
(Metadata) unmarshaller.unmarshal(document);
// Serialize metadata object structure
// into DOM document
Document newDocument = documentBuilder.newDocument(); marshaller.marshal(metadata, newDocument);
HyperJAXB
• Provides JAXB objects with relational persistence layer
• Automatically generates:– Database schema– Object-relational mapping for JAXB objects
HyperJAXB Example – The Schema (1)
• Excerpt from ISO 19115 XML Schema
• Metadata, identification information, bounding box elements
HyperJAXB Example – The Generated Object Structure (2)
HyperJAXB Example –The Generated Database Schema (3)
HyperJAXB Example –The Sample XML (4)
<metadata xmlns="http://www.fzi.de/dbs/tests/iso19115">
<fileIdentifier>id000001</fileIdentifier>
<language>en</language>
<hierarchyLevel>dataset</hierarchyLevel>
<hierarchyLevel>series</hierarchyLevel>
<identificationInfo>
<abstract>The abstract.</abstract>
<purpose>The purpose.</purpose>
<status>planned</status>
<geographicBox>
<extentTypeCode>true</extentTypeCode>
<westBoundLongitude>11.7254223679</westBoundLongitude>
<eastBoundLongitude>11.8123425682</eastBoundLongitude>
<southBoundLatitude>48.3282639631</southBoundLatitude>
<northBoundLatitude>48.4438272635</northBoundLatitude>
</geographicBox>
</identificationInfo>
</metadata>
HyperJAXB Example –The Insertion SQL (5)
INSERT INTO EXGEOGRAPHICBOUNDINGBOX VALUES('...0003',true,48.4438272635,48.3282639631,11.8123425682,11.7254223679)
INSERT INTO MDIDENTIFICATION VALUES('...0002','planned','The purpose.','...0003','The abstract.')
INSERT INTO MDMETADATA VALUES('...0001','id000001','en','...0002')
INSERT INTO METADATA VALUES('...0001')
INSERT INTO MDMETADATA_HIERARCHYLEVELINTERNAL VALUES('...0001','dataset',0)
INSERT INTO MDMETADATA_HIERARCHYLEVELINTERNAL VALUES('...0001','series',1)
HyperJAXB – Live Demo