XML 스키마 재정의 요소
❮ 완전한 XML 스키마 참조
정의 및 사용
redefine 요소는 외부 스키마에서 단순 및 복합 유형, 그룹 및 속성 그룹을 재정의합니다.
요소 정보
- 상위 요소: 스키마
통사론
<redefine
id=ID
schemaLocation=anyURI
any attributes
>
(annotation|(simpleType|complexType|group|attributeGroup))*
</redefine>
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
schemaLocation | Required. A URI to the location of a schema document |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
실시예 1
다음 예는 Myschema1.xsd에 의해 지정된 요소가 있는 Myschema2.xsd 스키마를 보여줍니다. pname 유형이 재정의됩니다. 이 스키마에 따르면 pname 유형으로 제한되는 요소는 "country" 요소로 끝나야 합니다.
Myschema1.xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="pname">
<xs:sequence>
<xs:element name="firstname"/>
<xs:element name="lastname"/>
</xs:sequence>
</xs:complexType>
<xs:element name="customer" type="pname"/>
</xs:schema>
Myschema2.xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:redefine schemaLocation="Myschema1.xsd">
<xs:complexType name="pname">
<xs:complexContent>
<xs:extension base="pname">
<xs:sequence>
<xs:element name="country"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:element name="author" type="pname"/>
</xs:schema>
❮ 완전한 XML 스키마 참조