问题描述
我正在尝试针对XML Schema 1.1在Intellij XML中进行验证。但是,它似乎不起作用。这是我得到的错误。已将Default XML Schemas
切换为XML Schema 1.1
。我想念什么?
/Users/user/tools/git/testxmlxsd/app/src/main/res/xml/assertion/assertion.xsd
Error:(10,39) s4s-elt-invalid-content.1: The content of '#AnonType_data' is invalid.
Element 'assert' is invalid,misplaced,or occurs too often.
验证XSD也不起作用。这里的错误:
Error:(936,30) rcase-Recurse.2: There is not a complete functional mapping between the particles.
Error:(936,30) derivation-ok-restriction.5.4.2: Error for type 'all'. The particle of the type is not a valid restriction of the particle of the base.
XML
<?xml version="1.0"?>
<data min="5" max="10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="assertion.xsd"/>
XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
vc:minVersion="1.1" elementFormDefault="qualified">
<xs:element name="data" vc:minVersion="1.0" vc:maxVersion="1.1">
<xs:complexType>
<xs:attribute name="min" type="xs:int"/>
<xs:attribute name="max" type="xs:int"/>
<xs:assert test="@min le @max"/>
</xs:complexType>
</xs:element>
</xs:schema>
解决方法
这是IntelliJ IDEA中的known issue。请投票/评论。