我正在尝试按顺序放置一个键,并且被错误轰炸。看来我不能这样做。此外,有人告诉我,我的密钥需要一个字段和选择器,但我几乎找不到相关文档。(事实上,在绝望中,我下载了 Liquid XML Studio [vs. Notepad] 并搜索了它的帮助文件......发现甚至没有提到“选择器”这个词)不管 - 我可以用什么方法来保证唯一,不是一个元素的空值,在一个序列中?(有问题的内容是一个字符串)
请注意,如果没有 key 元素,架构会验证。
错误
每个 cvc-complex-type.1.2.4 无效:元素 {http://www.w3.org/2001/XMLSchema}:key not allowed here (1) in element {http://www.w3.org/2001 /XMLSchema}:sequence, 期待 [{http://www.w3.org/2001/XMLSchema}:annotation, $, {http://www.w3.org/2001/XMLSchema}:element, {http:// /www.w3.org/2001/XMLSchema}:组,{http://www.w3.org/2001/XMLSchema}:选择,{http://www.w3.org/2001/XMLSchema}:序列, {http://www.w3.org/2001/XMLSchema}:any]:
架构
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="READOO" elementFormDefault="qualified">
<xs:element name="ReferralCollection">
<xs:complexType>
<xs:sequence>
<xs:key name="URL" type="string" />
<xs:element maxOccurs="unbounded" name="keyword">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="occurrences" type="xs:int" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>