각 책 항목에 대해 고유 ID를 지정해야하는 책에 XML 스키마를 설계하려고합니다. 그러나 그것은 단지 작동하지 않는 것 같습니다. 다음은 내가 사용하고있는 XSD,XML 스키마가 고유 한 중복 ID 허용 여전히
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="BookShelf">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Shelf" type="ShelfType" minOccurs="1" maxOccurs="10"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ShelfType">
<xs:sequence>
<xs:element ref="Book" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Book">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:token"/>
<xs:element name="Language" type="xs:language"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
<xs:unique name="unique-bookId">
<xs:selector xpath="Book"/>
<xs:field xpath="@id"/>
</xs:unique>
</xs:element>
</xs:schema>
나는 이것이으로 검증하기 위해 애 쓰고 XML, 심지어 안하지만 잘 검증되어
<?xml version="1.0"?>
<BookShelf>
<Description>My bookshelf</Description>
<Shelf>
<Book id="1">
<Title>Seitsemän veljestä</Title>
<Language>fi</Language>
</Book>
<Book id="1">
<Title>Another title</Title>
<Language>en</Language>
</Book>
</Shelf>
</BookShelf>
는 (I는 동일한 ID를 사용했습니다입니다 2 항목). XML을 처음 접했을 때 누군가 내가 여기서 잘못하고있는 것을 지적 해 주시면 감사하겠습니다.