在Intellij IDEA中验证XML Schema 1.1

问题描述

我正在尝试针对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。请投票/评论。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...