【发布时间】:2014-04-10 02:58:04
【问题描述】:
我是 XML 和 XSD 的新手,我一直在尝试将此 xsd 代码验证为 xml 文件,但没有任何成功。我在下面收到一个错误,我看不出有什么问题。任何帮助将不胜感激。
s4s-elt-invalid-content.1:内容 '#AnonType_endangered_species' 无效。元素“元素”是 无效、放错位置或过于频繁。
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="endangered_species">
<xsd:complexType>
<xsd:element name="animal" type="xsd:string" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" minOccurs="2" maxOccurs="2" type="xs:string">
<xsd:complexType>
<xsd:all>
</xsd:all>
<xsd:attribute ref="language">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="English"/>
<xsd:enumeration value="Latin"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:schema>
【问题讨论】: