Did not expect element there
An element the RelaxNG pattern does not allow at this point.
The message, as the validator reports it
Did not expect element extra there
Why it happens
- An element that is not in the schema, or is in a different namespace.
- Elements out of order: in a RelaxNG
group(the default) the order matters; onlyinterleavelets them come in any order.
How to fix it
Remove the element, move it to where the schema allows it, or put it in the namespace the schema uses.
Example
Validated against book.rng, below.
Reports the error
<book isbn="1">
<title>T</title>
<year>2020</year>
<extra/>
</book>
Fixed
<book isbn="1">
<title>T</title>
<year>2020</year>
</book>
book.rng
<element name="book" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<attribute name="isbn"><data type="string"/></attribute>
<element name="title"><text/></element>
<element name="year"><data type="gYear"/></element>
</element>