XML Schema redefine 元素

定义和用法

redefine 元素允许在当前 Schema 中重新定义从外部架构文件中获取的简单和复杂类型、组和属性组。

元素信息

出现次数 无限制
父元素 schema
内容 annotation、attributeGroup、complexType、group、simpleType

语法

any attributes
>
(annotation|(simpleType|complexType|group|attributeGroup))*

属性 描述
id 可选。规定该元素的唯一的 ID。
schemaLocation 必需。对 schema 文档位置的 URI 引用。
any attributes 可选。规定带有 non-schema 命名空间的任何其他属性。

Mfano

Maelezo 1

Maelezo ya maelezo yaliyotoka kwa Myschama1.xsd, Myschama2.xsd ina uhusiano wa kipengele kinachotumika kwa Myschama1.xsd. Tendapi ya kipengele kina uhusiano kwa "country" kwa kuzalishwa:

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>