简体   繁体   English

XSD元素类型不会以匹配的结束标签终止

[英]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.

相关问题 元素类型“xsd:schema”必须由匹配的结束标签“”终止 - The element type “xsd:schema” must be terminated by the matching end-tag “</xsd:schema>” 元素类型“xsd:sequence”必须由匹配的结束标签“”终止 - The element type “xsd:sequence” must be terminated by the matching end-tag “</xsd:sequence>” 元素类型“标签”必须以匹配的结束标签“</tag> ” - The element type "tag" must be terminated by the matching end-tag "</tag>" 元素类型“META”必须以匹配的结束标签“</META> ” - The element type “META” must be terminated by the matching end-tag “</META>” 元素类型 X 必须由匹配的结束标记终止 - The element type X must be terminated by the matching end-tag SaxParseException 元素类型“hr”必须由匹配的结束标记“终止</hr> “。在使用 jaxb 读取 xml 时 - SaxParseException The element type "hr" must be terminated by the matching end-tag "</hr>". while reading xml with jaxb "xs:element" 必须由匹配的结束标签 "" 我找不到错误 - "xs:element" must be terminated by the matching end-tag "</xs:element>" i can´t find error 如何解决这个错误“元素类型”头“必须由匹配的结束标记”</ head>“终止>? - How to solve this error “The element type ”head“ must be terminated > by the matching end-tag ”</head>"? TypeError:错误#1085:元素类型“ opi1”必须以匹配的结束标记“ </opi1> ” - TypeError: Error #1085: The element type “opi1” must be terminated by the matching end-tag “</opi1>” hive-site.xml:元素类型“configuration”必须由匹配的end-tag终止“ </configuration> ” - hive-site.xml: The element type “configuration” must be terminated by the matching end-tag “</configuration>”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM