1
以下代碼在驗證期間給我提供以下錯誤。這是否意味着我無法在complexType元素中嵌套simpleType元素?在complexType中嵌套simpleType
Error - Line 18, 17: org.xml.sax.SAXParseException; lineNumber: 18; columnNumber: 17; s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: simpleType.
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/carType"
elementFormDefault="qualified">
<element name="carType">
<complexType>
<sequence>
<simpleType name="colour">
<restriction base="string">
<enumeration value="blue" />
<enumeration value="yellow" />
<enumeration value="green" />
<enumeration value="black" />
<enumeration value="white" />
</restriction>
</simpleType>
<simpleType name="body">
<restriction base="string">
<enumeration value="sedan" />
<enumeration value="hatchback" />
</restriction>
</simpleType>
</sequence>
</complexType>
</element>
</schema>
不,它不需要。您可以從簡單類型構造複雜類型。 – 2014-12-01 21:32:31