我附带了一个 xml 架构来创建一个 xml 文档。根节点是电影。现在这个根元素有称为movie的子元素,其中包含字符串类型的其他元素,每部电影也有大约三四个属性。但是,在将我的 XML 文档与模式链接后,我只能创建一个电影节点,仅此而已。这是我的 xml 架构:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--root element movies -->
<xsd:element name="movies">
<xsd:complexType >
<xsd:all >
<xsd:element name="movie">
<xsd:complexType >
<xsd:sequence>
<!--Elements under each movie-->
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="writer" type="xsd:string"/>
<xsd:element name="producer" type="xsd:string"/>
<xsd:element name="director" type="xsd:string"/>
<!--Not sure the number of actors a movie can have -->
<xsd:element name="actor" type="xsd:string" maxOccurs="unbounded"/>
<xsd:element name="poster" type="xsd:string"/>
<xsd:element name="comments" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="type" use="required">
<!--attribute type with its options -->
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="drama"/>
<xsd:enumeration value="comedy"/>
<xsd:enumeration value="adventure"/>
<xsd:enumeration value="sci-fi"/>
<xsd:enumeration value="mystery"/>
<xsd:enumeration value="horror"/>
<xsd:enumeration value="romance"/>
<xsd:enumeration value="documentary"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="rating" use="required">
<!--attribute rating with its options -->
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="G"/>
<xsd:enumeration value="PG"/>
<xsd:enumeration value="PG-13"/>
<xsd:enumeration value="X"/>
<xsd:enumeration value="ua"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="review" use="optional">
<!--attribute review with its options -->
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="1"/>
<xsd:enumeration value="2"/>
<xsd:enumeration value="3"/>
<xsd:enumeration value="4"/>
<xsd:enumeration value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="year" use="optional">
<!--attribute year -->
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
有人可以帮忙找出我的错误吗?