Help interpreting validation errors
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 2
- Joined: Tue Mar 26, 2019 1:50 pm
Help interpreting validation errors
Post by thevenkster »
Hi:
I am validating an XML document against an XSD. A snippet of the offending XSD is below:
<xs:element name="record">
<xs:complexType>
<xs:sequence>
<xs:element name="recordID" type="string100"/>
<xs:element name="recordUserId" type="string30" minOccurs="0" maxOccurs="1"/>
<xs:element name="recordDeletedDate" type="xs:dateTime" minOccurs="0" maxOccurs="1"/>
<xs:element name="termType" type="string100"/>
<xs:element name="repTerm" type="string4000"/>
<xs:element name="altTerm" type="string4000" minOccurs="0" maxOccurs="1"/>
<xs:element name="repAltApproved" type="string1" minOccurs="0" maxOccurs="1"/>
<xs:element name="intCode" type="string50" minOccurs="0" maxOccurs="1"/>
<xs:element name="intTerm" type="string4000" minOccurs="0" maxOccurs="1"/>
<xs:element name="intPrefCode" type="string50" minOccurs="0" maxOccurs="1"/>
<xs:element name="intPrefTerm" type="string4000" minOccurs="0" maxOccurs="1"/>
<xs:element name="intCodeDate" type="xs:dateTime" minOccurs="0" maxOccurs="1"/>
<xs:element ref="recordInfo" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
and I get the following errors:
Element <termType> is not allowed at this location under element <record>.
Reason: The following elements are expected at this location (see below)
'recordID'
Error location: MPWS / body / records / record / termType
Details
cvc-complex-type.1.4: Element <termType> unexpected at this location by type '{anonymous}' of element <record>.
cvc-type.3.2: Element <record> is not valid with respect to type definition '{anonymous}'.
cvc-elt.5.2.1: The element <record> is not valid with respect to the actual type definition '{anonymous}'.
Element <termType> is not allowed at this location under element <record>.
Reason: The following elements are expected at this location (see below)
'recordID'
Error location: MPWS / body / records / record / termType
Details
cvc-complex-type.1.4: Element <termType> unexpected at this location by type '{anonymous}' of element <record>.
cvc-type.3.2: Element <record> is not valid with respect to type definition '{anonymous}'.
cvc-elt.5.2.1: The element <record> is not valid with respect to the actual type definition '{anonymous}'.
I am no able to interpret the error. Can someone advise me?
Venki
I am validating an XML document against an XSD. A snippet of the offending XSD is below:
<xs:element name="record">
<xs:complexType>
<xs:sequence>
<xs:element name="recordID" type="string100"/>
<xs:element name="recordUserId" type="string30" minOccurs="0" maxOccurs="1"/>
<xs:element name="recordDeletedDate" type="xs:dateTime" minOccurs="0" maxOccurs="1"/>
<xs:element name="termType" type="string100"/>
<xs:element name="repTerm" type="string4000"/>
<xs:element name="altTerm" type="string4000" minOccurs="0" maxOccurs="1"/>
<xs:element name="repAltApproved" type="string1" minOccurs="0" maxOccurs="1"/>
<xs:element name="intCode" type="string50" minOccurs="0" maxOccurs="1"/>
<xs:element name="intTerm" type="string4000" minOccurs="0" maxOccurs="1"/>
<xs:element name="intPrefCode" type="string50" minOccurs="0" maxOccurs="1"/>
<xs:element name="intPrefTerm" type="string4000" minOccurs="0" maxOccurs="1"/>
<xs:element name="intCodeDate" type="xs:dateTime" minOccurs="0" maxOccurs="1"/>
<xs:element ref="recordInfo" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
and I get the following errors:
Element <termType> is not allowed at this location under element <record>.
Reason: The following elements are expected at this location (see below)
'recordID'
Error location: MPWS / body / records / record / termType
Details
cvc-complex-type.1.4: Element <termType> unexpected at this location by type '{anonymous}' of element <record>.
cvc-type.3.2: Element <record> is not valid with respect to type definition '{anonymous}'.
cvc-elt.5.2.1: The element <record> is not valid with respect to the actual type definition '{anonymous}'.
Element <termType> is not allowed at this location under element <record>.
Reason: The following elements are expected at this location (see below)
'recordID'
Error location: MPWS / body / records / record / termType
Details
cvc-complex-type.1.4: Element <termType> unexpected at this location by type '{anonymous}' of element <record>.
cvc-type.3.2: Element <record> is not valid with respect to type definition '{anonymous}'.
cvc-elt.5.2.1: The element <record> is not valid with respect to the actual type definition '{anonymous}'.
I am no able to interpret the error. Can someone advise me?
Venki
-
- Posts: 2
- Joined: Tue Mar 26, 2019 1:50 pm
Re: Help interpreting validation errors
Post by thevenkster »
Well, a little research taught me something new!
The key is xs:sequence. If this is used, the elements in the XML have to be in the same order as specified in the XSD.
As opposed to xs:all in which case the order can be different.
Venki
The key is xs:sequence. If this is used, the elements in the XML have to be in the same order as specified in the XSD.
As opposed to xs:all in which case the order can be different.
Venki
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service