cvc-complex-type.2.4.d: Invalid content was found starting with element 'id'. No child element is expected at this point.
之前的那个程序 在进行schem验证的时候报错:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="post" type="postType" /> <xs:complexType name="postType"> <xs:sequence> <xs:element name="id" type="xs:long" minOccurs="0"></xs:element> <xs:element name="tiebaName" type="xs:string" minOccurs="0"></xs:element> <xs:element name="url" type="xs:string" minOccurs="0"></xs:element> <xs:element name="title" type="xs:string" minOccurs="0"></xs:element> <xs:element name="author" type="xs:string" minOccurs="0"></xs:element> </xs:sequence> </xs:complexType> </xs:schema>
这是由于schema文件写的不规范
将 <xs:sequence> 改成如下 <xs:sequence maxOccurs="unbounded">
问题解决
=============================
至于为什么 还不是很懂
摘自网友的一段话:
这个问题的原因是:
1.你没有指定为可控制重复性,使用minOccurs和maxOccurs属性(它们不仅对元素声明有效,而且对sequence、choice、all也是有效的)。它们的默认值都是1,表示元素必需出现且只能出现一次(可以自己定义整数形式)。
2.还有两个特殊的:当minOccurs为0时,该元素是可选的。当maxOccurs等于关键字unbounded时,该元素可以无限重复。
http://bbs.xml.org.cn/dispbbs.asp?boardID=23&ID=52460
最后
以上就是霸气蜗牛最近收集整理的关于Invalid content was found starting with element No child element is expected at this point.的全部内容,更多相关Invalid内容请搜索靠谱客的其他文章。
发表评论 取消回复