2
我想知道是否可以區分XML模式中的ID字段。我有以下架構:引用XML模式中的多個ID(XSD)
<element name="define_apple">
<complexType>
<attribute name="colour" type="ID"/>
</complexType>
</element>
<element name="define_orange">
<complexType>
<attribute name="colour" type="ID"/>
</complexType>
</element>
<element name="reference_apple">
<complexType>
<attribute name="colour" type="IDREF"/>
</complexType>
</element>
<element name="reference_orange">
<complexType>
<attribute name="colour" type="IDREF"/>
</complexType>
</element>
但是,引用不是唯一鏈接到相應的定義。我仍然可以寫下面廢話,但有效的XML:
<define_apple colour="green"/>
<define_orange colour="orange"/>
<reference_apple colour="orange"/>
<reference_orange colour="green"/>
有沒有辦法來鏈接域正確使用ID和IDREF,例如使用命名空間?我知道我可以使用key和keyref,但ID對我來說更吸引人。
慚愧......但謝謝你指出了這一點。 – DonDiesl