good/Language
XML Simple Type, facet 적용
coodnoob
2009. 12. 7. 09:55
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.kitri.re.kr/2009-12-03/BookStore" targetNamespace="http://www.kitri.re.kr/2009-12-03/BookStore" elementFormDefault="qualified">
<xsd:simpleType name="stCategory">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="autobiography" />
<xsd:enumeration value="fiction" />
<xsd:enumeration value="non-fiction" />
</xsd:restriction>
</xsd:simpleType> 정의는 여기서
<xsd:element name="BookStore">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Book" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Title" type="xsd:string"/>
<xsd:element name="Author" type="xsd:string"/>
<xsd:element name="Date" type="xsd:gYear"/>
<xsd:element name="ISBN" type="xsd:string"/>
<xsd:element name="Publisher" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="Category" type="ns1:stCategory" use="required"/> 사용은 여기서 타입을 정의한 부분의 해당네임스페이스 사용
<xsd:attribute name="InStock" type="xsd:string" use="optional"/>
<xsd:attribute name="Reviewer" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>