SDO annotations are extensions to XML Schema definitions (XSDs). The annotations guide the conversion of XSDs to Data Objects and are necessary when the default conversion is not appropriate or when SDO requires information that is not otherwise found in an XSD.
SDO annotations are now available for Java code and are expected to be available for all languages.
The SDO annotations are in boldface in the XSD shown in Listing 10.1, which is based on an example in the SDO Java specification.
Listing 10.1: XSD featuring SDO annotations
<schema targetNamespace="http://www.example.com/IPO" xmlns:ipo="http://www.example.com/IPO" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoXML="commonj.sdo/XML" xmlns:sdoJava="commonj.sdo/java" sdoJava:package="com.example.myPackage"> <complexType name="PurchaseOrderType" > <sequence> <element name="shipmentID" type="string"/> . . </sequence> <attribute name="orderDate" type="date" sdo:dataType="ipo:MyGregorianDate"/> </complexType> <simpleType name="MyGregorianDate" sdoJava:instance/> </schema>
As a result of those annotations:
The SDO-generated Java classes are assigned to the package com.example.myPackage.
The orderDate property contains a Data Object that is defined by the simple type MyGregorianDate.
Each Data Object that is defined by simple type MyGregorianDate is based on the Java class java.xml.datatype.GregorianCalendar.
For details on SDO annotations, see Chapter 9 of Service Data Objects for Java Specification Version 2.1.0.