I have seen examples of how to use a unique tag directly in an element declaration in xsd, but I cannot figure out how to put an element in a declaration, which is a complex type, see the following code:
<xs:complexType name="flighttype"> <xs:sequence> <xs:element name="departure" type="departuretype"/> <xs:element name="arrival" type="arrivaltype"/> <xs:element name="altitude" type="xs:string"/> <xs:element name="speed" type="xs:string"/> <xs:element name="distance" type="xs:string"/> <xs:element name="entertainment" type="entertainmenttype"/> <xs:element name="safetymessage" type="xs:string"/> </xs:sequence> <xs:attribute name="id" type="xs:string"/> <xs:attribute name="airline" type="xs:string"/> <xs:attribute name="flightno" type="xs:string"/> <xs:attribute name="model" type="xs:string"/> <xs:attribute name="passengers" type="xs:integer"/> <xs:attribute name="status" type="xs:string"/> </xs:complexType>
I want to make id a unique id, I can get the following example to work, but it is used directly in the element declaration.
Example
Thanks!
source share