4
我已經看到了如何在一個XSD中的元素聲明中直接使用的唯一的標籤的例子,但我無法弄清楚如何放入元素聲明這是一個複雜類型,請參見下面的代碼:如何在複雜類型的xsd文件中使用唯一標記?
<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>
我想讓id爲一個唯一的id,我可以得到下面的例子,但它直接在元素聲明中使用。
謝謝!
謝謝你的建議,幫助我弄明白了! :) – deucalion0