【发布时间】:2014-04-10 22:02:36
【问题描述】:
我正在使用 JDK 7 在 IDEA 13.02 中试用 XML SCHEMA 1.1
这是我从教程中获得的 XML 模式代码。当我在 IntelliJ IDEA 中打开此文件并单击“验证”时,出现以下错误:
cvc-complex-type.2.4.a:发现无效内容以 元素“开放内容”。之一 '{"http://www.w3.org/2001/XMLSchema":注解, "http://www.w3.org/2001/XMLSchema":simpleContent, "http://www.w3.org/2001/XMLSchema":complexContent, "http://www.w3.org/2001/XMLSchema":group, “http://www.w3.org/2001/XMLSchema”:全部, “http://www.w3.org/2001/XMLSchema”:选择, “http://www.w3.org/2001/XMLSchema”:序列, “http://www.w3.org/2001/XMLSchema”:属性, "http://www.w3.org/2001/XMLSchema":attributeGroup, 应为“http://www.w3.org/2001/XMLSchema”:anyAttribute}'。
这是使用 XML Schema 1.1 增强的 XSD 文件:
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.books.org"
xmlns:pub="http://www.books.org"
elementFormDefault="qualified">
<complexType name="Publication" abstract="true">
<openContent mode="interleave">
<any />
</openContent>
<sequence>
<element name="Title" type="string" />
<element name="Author" type="string" />
<element name="Date" type="gYear"/>
</sequence>
</complexType>
<complexType name="BookPublication">
<complexContent>
<extension base="pub:Publication">
<openContent mode="none">
</openContent>
<sequence>
<element name="ISBN" type="string"/>
<element name="Publisher" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="BookStore">
<complexType>
<sequence>
<element name="Book" type="pub:BookPublication" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
</schema>
有没有办法验证或升级 IDEA 使用的验证器?
【问题讨论】:
标签: xml intellij-idea xsd xml-validation