I'm trying to validate three XML files, each of which I get the same two errors from. The scheme used for validation was created with Oxygen 18.0 using the scheme generation function (specifically using the three XMLs).
The errors are:
cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.tei-c.org/ns/1.0":p}'. One of '{"http://www.tei-c.org/ns/1.0":div}' is expected.
and
cvc-complex-type.2.4.b: The content of element 'div' is not complete. One of '{"http://www.tei-c.org/ns/1.0":p}' is expected.
They always refer to the following elements enclosed in: ** **
<?xml version="1.0" encoding="utf-8"?>
<text rend="Section" xml:lang="kat">
<body>
<**div** type="Content" n="1">
<div type="Section" n="1">
<**p**>
I am not sure whether it is due to a faulty scheme (there's a problem preventing me from uploading it right now) or if the the document itself is causing the error. All the documents are however well-formed.
Other sources say that it gets fixed by changing the Default to elementFormDefault="qualified"
but my XML already contains that. I expect the error to either be associated to targetNamespace="http://www.tei-c.org/ns/1.0"
(which is part of the XML), or a wrong order of elements. It may have to do with minOccurs="0"
as well - but as to this point I've read so many threads that I have lost track of a sensible solution.
The obvious is triple checked: the tags are correctly closed at the end
</div></div>
</body>
</text>
This is the XML used above: http://pastebin.com/USKZxXM4
The content model for div
allows it to be empty or to consist of a sequence of div
and p
:
<xs:sequence minOccurs="0">
<xs:element ref="ns1:div"/>
<xs:element ref="ns1:p"/>
</xs:sequence>
Given that your XML has one div
element with a div
child and another div
element with a p
child, you instead should make div
's content model be a sequence of optional children:
<xs:sequence>
<xs:element ref="ns1:div" minOccurs="0"/>
<xs:element ref="ns1:p" minOccurs="0"/>
</xs:sequence>
if both may be present, or a choice of either:
<xs:choice>
<xs:element ref="ns1:div"/>
<xs:element ref="ns1:p"/>
</xs:choice>
if only one may be present.