I am trying out XML SCHEMA 1.1 in IDEA 13.02 with JDK 7
This is an XML schema code I got from a tutorial. When I open this file in IntelliJ IDEA and click "Validate" , I get the following errors:
cvc-complex-type.2.4.a: Invalid content was found starting with
element 'openContent'. One of
'{"http://www.w3.org/2001/XMLSchema":annotation,
"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":all,
"http://www.w3.org/2001/XMLSchema":choice,
"http://www.w3.org/2001/XMLSchema":sequence,
"http://www.w3.org/2001/XMLSchema":attribute,
"http://www.w3.org/2001/XMLSchema":attributeGroup,
"http://www.w3.org/2001/XMLSchema":anyAttribute}' is expected.
This is the XSD File using XML Schema 1.1 enhancements:
<?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>
Is there a way to validate this or upgrade the validator used by IDEA ?
Best Solution
Try adding
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
andvc:minVersion="1.1"
to<schema>
:It will inform IDEA that you are using a XSD 1.1 Schema.
I've used XSD 1.1 with WebStorm 8, which I believe uses the same parser as IDEA.