计算机系专用,黄学平编
例如:3.用匿名类型编写
<?xml version="1.0" encoding=”UTF-8”?>
<xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLschema
<xsd:element name=”book”>
<xsd:complexType>
<xsd:sequnce>
<xsd:element name=”title” type=”xsd:string”/>
<xsd:element name=”author” type=”xsd:string”/>
<xsd:element name=”price” type=”xsd:decimal”/>
</xsd:sequnce>
</xsd:compexType>
</xsd:element>
用命名类型编写
<?xml version="1.0" encoding=”UTF-8”?>
<xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLschema
<xsd:element name=”book” type=”BookType”>
<xsd:complexType name=”BookType”>
<xsd:sequnce>
<xsd:element name=”title” type=”xsd:string”/>
<xsd:element name=”author” type=”xsd:string”/>
<xsd:element name=”price” type=”xsd:decimal”/>
</xsd:sequnce>
</xsd:compexType>
</xsd:element>