0

XSD validation fails from http://www.utilities-online.info/xsdvalidation/. I tried may different XSD submission - all failed. I copied a simple code example from prior posting.

Error - s4s-elt-invalid-content.1: The content of '#AnonType_root' is invalid. Element 'assert' is invalid misplaced, or occurs too often.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
           vc:minVersion="1.1">

  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="Type" type="xs:integer" />
        <xs:element minOccurs="0" maxOccurs="1" name="Comment" type="xs:string" />
      </xs:sequence>
      <xs:assert test="Comment or not(Type = 0)"/>
    </xs:complexType>
  </xs:element>

</xs:schema>
unor
  • 92,415
  • 26
  • 211
  • 360

2 Answers2

0

It reports the same error even when instead of <xs:assert> you write <xs:aaassert>. That means, it doesn't understand XSD 1.1

Also, on that page http://www.utilities-online.info/xsdvalidation/, you can read:

The library used in this page is jaxp, Java API for XML Processing, version 1.4, from Java(TM) SE Runtime Environment (build 1.7.0_06-b24).

So, they actually use JAXP 1.4. On the other hand, in Java library that supports XSD 1.1 it is mentioned that JAXP 1.4 doesn't support XSD 1.1 properly.

Well, that's what it means using some free-for-all online stuff. You should expect it and be ready to look for something else...

ColdFusion
  • 2,381
  • 13
  • 14
0

Thank you unor and ColdFusion. ColdFusion, clever test, I will keep that in mind for the future. I did find another free validator that does support assertions. https://www.liquid-technologies.com/online-xsd-validator . All in all it is a better validator that identifies the actual location of XSD syntax errors. The first validator doesn't indicate XSD syntax error locations.