模式:
<xs:complexType>
<xs:sequence>
<xs:element ref="FileCreationList"/>
<xs:element ref="DivestedExample"/>
</xs:sequence>
<xs:attribute name="mylns:xsi" type="xs:string"/>
<xs:attribute name="xsi:schemaLocation" type="xs:string"/>
</xs:complexType>
错误:
Multiple annotations found at this line:
- s4s-att-invalid-value: Invalid attribute value for 'name' in element 'attribute'. Recorded reason: cvc-datatype-valid.1.2.1: 'mylns:xsi' is not a valid
value for 'NCName'.
- src-attribute.3.1: One of 'ref' or 'name' must be present in a local attribute declaration.
- s4s-elt-invalid-content.1: The content of '#AnonType_File' is invalid. Element 'attribute' is invalid, misplaced, or occurs too often.
发布于 2016-05-09 04:32:51
属性名称声明必须是NCNames (非殖民化名称):
NCName ::= (字母'_') (NCNameChar)* /*一个XML名称,减去":“*/
从mylns:xsi
和xsi:schemaLocation
中删除冒号以消除错误。
Notes
xsi:schemaLocation
声明为属性;声明并引用http://www.w3.org/2001/XMLSchema-instance
命名空间:发布于 2016-05-09 11:06:51
通常,如果要声明使用不同命名空间中的属性的元素,则需要(a)使用不同的targetNamespace在单独的XSD文档中声明这些属性,(b)使用xs:import导入该XSD文档,(c)使用<xs:attribute ref="somens:localname"/>
引用属性声明。
然而:
(i)名称空间声明(xmlns:xx="uri")不被认为是属性,不需要在模式中声明(实际上,不能声明)。
(ii) "xsi“命名空间中的属性是特殊的--它们在每个元素上都是自动允许的,不应该在模式中声明。
https://stackoverflow.com/questions/37106578
复制相似问题