XSD(XML Schema Define)中一个复杂的纯文本元素可以包含文本和属性。
-------------------------------------------------- ------------------------------
复合纯文本元素
这种类型只包含简单的内容(文本和属性),所以我们可以先添加一个xs:simpleContent元素,接着在xs:simpleContent中定义xs:extension或者xs:restriction。
如下:
![ContractedBlock.gif](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
<
xs:element
name
="somename"
>
< xs:complexType >
< xs:simpleContent >
< xs:extension base ="basetype" >
....
....
</ xs:extension >
</ xs:simpleContent >
</ xs:complexType >
</ xs:element >
< xs:complexType >
< xs:simpleContent >
< xs:extension base ="basetype" >
....
....
</ xs:extension >
</ xs:simpleContent >
</ xs:complexType >
</ xs:element >
OR
![ContractedBlock.gif](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
<
xs:element
name
="somename"
>
< xs:complexType >
< xs:simpleContent >
< xs:restriction base ="basetype" >
....
....
</ xs:restriction >
</ xs:simpleContent >
</ xs:complexType >
</ xs:element >
< xs:complexType >
< xs:simpleContent >
< xs:restriction base ="basetype" >
....
....
</ xs:restriction >
</ xs:simpleContent >
</ xs:complexType >
</ xs:element >
实例:
<
shoesize
country
="france"
>
35
</
shoesize
>
xsd:
![ContractedBlock.gif](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
<
xs:element
name
="shoesize"
>
< xs:complexType >
< xs:simpleContent >
< xs:extension base ="xs:integer" >
< xs:attribute name ="country" type ="xs:string" />
</ xs:extension >
</ xs:simpleContent >
</ xs:complexType >
</ xs:element >
< xs:complexType >
< xs:simpleContent >
< xs:extension base ="xs:integer" >
< xs:attribute name ="country" type ="xs:string" />
</ xs:extension >
</ xs:simpleContent >
</ xs:complexType >
</ xs:element >