xml 및 schema를 학습 중입니다. 전화 요소 값이 고유해야하는 스키마가 필요합니다. 나는 독특한 것으로 시도하지만 어떻게 작동하는지 이해할 수는 없습니다. 이 바보 같은 질문에 대해 유감스럽게 생각하지만 저는 배웁니다.전화 요소에 대해 고유 한 값을 원합니다.
XML
<?xml version="1.0" encoding="utf-8" ?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Employee>
<Name>ABC</Name>
<Telephone>9998887770</Telephone>
</Employee>
<Employee>
<Name>DEF</Name>
<Telephone>9998887770</Telephone>
</Employee>
<Employee>
<Name>GHI</Name>
<Telephone>1234567890</Telephone>
</Employee>
</Company>
스키마
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="EmployeeSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Name"/>
<xs:element name="Telephone" />
<xs:simpleType name="string32">
<xs:restriction base="xs:token">
<xs:maxLength value="32"/>
</xs:restriction>
<xs:element name="Company">
<xs:complexType>
<xs:sequence>
<xs:element ref="Employee" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!--Here i try to implement unique--->
<xs:unique name="Company">
<xs:selector xpath="Telephone"/>
<xs:field xpath="Telephone"/>
</xs:unique>
</xs:element>
<xs:element name="Employee">
<xs:complexType>
<xs:sequence>
<xs:element ref="Name"/>
<xs:element ref="Telephone"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
"나는 독특하지만 어떻게 작동하는지 이해할 수 없습니다." 어떤 책을 읽었습니까? Priscilla Walmsley를 추천합니다. XS : 순서> <: 내가 ** @MichaelKay –
/xs : complexType> __ 여기에 코드를 작성해도 여전히 작동하지 않습니다 .__ ** –