Beispiel für ein XML-Schema mit Annotationen
Das folgende Beispiel zeigt eine XSD-Datei (.xsd), die Ereignisse und Entitäten beschreibt.
<?xml version="1.0" encoding="UTF-8"?>
<schema elementFormDefault="qualified"
targetNamespace="http://www.example.org/bagscan"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.example.org/bagscan">
<element name="bag_scan" type="tns:BagScan"/>
<element name="takeoff_flight_event" type="tns:TakeOffFlightEvent"/>
<element name="scan_entity" type="tns:Scan"/>
<complexType name="BagScan">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<event/>
</appinfo>
</annotation>
<sequence>
<element name="scanTime" type="dateTime">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<timestamp/>
</appinfo>
</annotation>
</element>
<element name="scanID" type="string">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<businessName name="scan"/>
<businessType type="org.example.bagscan.Scan"/>
</appinfo>
</annotation>
</element>
<element name="airportTag" type="string"/>
<element name="bagID" type="string"/>
</sequence>
</complexType>
<complexType name="TakeOffFlightEvent">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<event/>
</appinfo>
</annotation>
<sequence>
<element name="takeOffTime" type="dateTime">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<timestamp/>
</appinfo>
</annotation>
</element>
</sequence>
</complexType>
<complexType name="Scan">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<entity/>
</appinfo>
</annotation>
<sequence>
<element name="scanId" type="string">
<annotation>
<appinfo source="http://www.ibm.com/ia/Annotation">
<entityId/>
</appinfo>
</annotation>
</element>
</sequence>
</complexType>
</schema>