[英]XSD element type won't terminate with matching end-tag
I'm receiving an error message for the XSD code - "The element type "element" must be terminated by the matching end-tag /element"..This shows on line /all.. This is only happening to one element type and not the others which I don't understand 我收到有关XSD代码的错误消息-“元素类型“元素”必须由匹配的结束标记/ element终止”。这显示在/ all行上。这仅发生在一种元素类型上,不是我不理解的其他人
<?xml version = "1.0"?> <schema xmlns:xsd = "http://wwww.w3.org/2001/XMLSCHEMA" xmlns:nutrition = "http://wwww.grandmascookies.com/nutrition" targetNamespace = "http://www.grandmascookies.com/nutrition"> <simpleType name = "amount"> <restriction base = "int"/> </simpleType> <simpleType name = "unit"> <restriction base = "string"/> </simpleType> <complexType name = "nutritionFact"> <all> <element name = "amount" type = "nutrition:amount"/> <element name = "unit" type = "nutrition:unit"/> </all> </complexType> <complexType name = "productType"> <all> <element name = "product" type = "string"> <element name = "servingsize" type = "nutrition:nutritionFact"/> <element name = "calories" type = "nutrition:nutritionFact"/> <element name = "caloriesFat" type = "nutrition:nutritionFact"/> <element name = "gramsFat" type = "nutrition:nutritionFact"/> <element name = "saturatedFat" type = "nutrition:nutritionFact"/> <element name = "mgCholestral" type = "nutrition:nutritionFact"/> <element name = "mgSodium" type = "nutrition:nutritionFact"/> <element name = "totalCarbs" type = "nutrition:nutritionFact"/> <element name = "fiber" type = "nutrition:nutritionFact"/> <element name = "sugar" type = "nutrition:nutritionFact"/> <element name = "protein" type = "nutrition:nutritionFact"/> </all> </complexType> <xsd:complexType name = "productType1"> <xsd:all> <xsd:element name = "item" type = "nutrition:productType"/> <xsd:element name = "items" type = "nutrition:productType1"/> </xsd:all> </xsd:complexType> </schema>
Change 更改
<element name = "product" type = "string">
to 至
<element name = "product" type = "string"/>
^
to eliminate the error. 消除错误。
The reason the error is reported upon closure of all
is that until that point, it's still possible for the unclosed element
to be closed such that the XML could be well-formed. 在
all
关闭时报告错误的原因是,直到那一刻,仍可能关闭未关闭的element
,以便XML的格式正确。 Once the all
is closed, however, it's clear that well-formedness is impossible. 但是,一旦
all
都解决了,那么显然就不可能形成良好的形式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.