<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3school.com.cn"
xmlns="http://www.w3school.com.cn"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
定義簡易元素
定義簡易元素的語法:
<xs:element name="xxx" type="yyy"/>
定義屬性
限定(restriction)用于為 XML 元素或者屬性定義可接受的值。對 XML 元素的限定被稱為 facet。
使用 extension 或 restriction 元素來擴展或限制元素的基本簡易類型。