2
我用全局唯一標識符(GUID)爲我的XML元素,模式是這樣的:GUID屬性爲IDREF在XSD架構
<xs:simpleType name="guidType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]
{4}-[a-fA-F0-9]{12}"/>
</xs:restriction>
</xs:simpleType>
和XML元素是這樣的:
<point guid="5C815FB2-0731-4E88-9885-CFC49B8E7B92" id="ABC" x="12" y="51" z="0"/>
通訊XSD模式:
<xs:complexType name="pointType">
<xs:attribute name="guid" type="guidType" use="required"/>
<xs:attribute name="id" type="xs:token" use="required"/>
<xs:attribute name="x" type="xs:double" use="required"/>
<xs:attribute name="y" type="xs:double" use="required"/>
<xs:attribute name="z" type="xs:double" use="required"/>
</xs:complexType>
我想引用另一個元素我點元素,如:
<layer>
<pointref guidref="5C815FB2-0731-4E88-9885-CFC49B8E7B92"/>
<pointref guidref="4671EFD4-506F-4A61-BCF0-427875074115"/>
</layer>
我可以使用ID和IDREF類型的改變架構文件我點類型定義實現它:
<xs:attribute name="guid" type="xs:ID" use="required"/>
問:
有沒有什麼辦法讓XS:ID類型也是類型的GUID?