Visual Studioでは、私が見ることができないエラーはXMLスキーマの定義に対して実際には起こりませんでした。XMLスキーマはrefを使用するときに一意に使用できますか?
私は私がそれにref要素のコレクションにユニーク制約を持つ
When the ref attribute is present, the type attribute and complexType, simpleType, key, keyref, and unique elements cannot be present.
は、この正しいですので、私はそれが親の中に子要素を宣言するように強制していた場合に言いますか?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://mysticwarlords.kaa/XMLSchema"
xmlns="http://mysticwarlords.kaa/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="titletype">
<xs:restriction base="xs:string">
<xs:enumeration value="Warlord"/>
<xs:enumeration value="FirstMate"/>
<xs:enumeration value="Jester"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="warlord">
<xs:complexType>
<xs:sequence>
<xs:element name="warlordName" type="xs:string"/>
</xs:sequence>
<xs:attribute name="title" type="titletype" />
</xs:complexType>
</xs:element>
<xs:element name="warband">
<xs:complexType>
<xs:sequence>
<xs:element name="warbandName" type="xs:string" />
<xs:element name="warlords">
<xs:complexType>
<xs:sequence>
<xs:element ref="warlord" minOccurs="1" maxOccurs="unbounded">
<xs:unique name="eachTitleOnlyOnce">
<xs:selector xpath="warlord"/>
<xs:field xpath="@title"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
私はUniqueを正しく使用していますか?
EDIT
これについて何:
<xs:complexType name="warlordtype">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="title" type="titletype" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="warband">
<xs:complexType>
<xs:sequence>
<xs:element name="warbandName" type="xs:string" />
<xs:element name="warlords">
<xs:complexType>
<xs:sequence>
<xs:element name="warlord" type="warlordtype" minOccurs="1" maxOccurs="unbounded">
<xs:unique name="eachTitleOnlyOnce">
<xs:selector xpath="warlord"/>
<xs:field xpath="@title"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
なぜ、この作品ではないでしょうか?
私には分かりませんが、私は可能です:P 私は要素内でユニークを宣言できました。要素を複数の場所で使用し、それらのコレクションのうちの1つでユニークでない場合はどうなりますか? –
私はそれがXSDで可能だとは思わない。 [タイプを再利用する](http://www.codeproject.com/Articles/11057/XSD-Using-the-include-element-for-schematic-reuse)タイプではありませんが、一意ではありません。 [unique](http://www.w3schools.com/schema/el_unique.asp)の親要素も "要素"のみになります。 –
軍隊を型にするとどうしてユニークな仕事ができないのですが、どうすればそれを動作させることができますか? –