xmlxsdsimpletype

simpletype is invalid in this context


I'm trying to validate my XSD as a valid XSD (as opposed to validating against XML), but I'm getting the following error:

XmlSchema error: Element http://www.w3.org/2001/XMLSchema:simpletype is invalid in this context. Line 6, Position 17. Related schema item SourceUri: virtual://server/schema.xsd, Line 4, Position 12.

I've been looking into it, but everything I've found makes me think I've formed this correctly - so it's probably something obvious and dumb :(

Here's my XSD cut down to the relevant section:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="DateTime">
        <xs:sequence>
            <xs:element name="TimeZone" default="GMT">
                <xs:simpletype>
                    <xs:union>
                        <xs:simpleType>
                            <xs:restriction base="string">
                                <xs:pattern value="GMT[+|-][[0|1][0-9]|2[0-3]][[:|][0-5][0-9]|]"/>
                            </xs:restriction>
                        </xs:simpleType>
                        <xs:simpleType>
                            <xs:restriction base="string">
                                <xs:enumeration value="GMT"/>
                                <xs:enumeration value="UTC"/>
                                <xs:enumeration value="PST"/>
                                <!--600+ more enumerations-->
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:union>
                </xs:simpletype>
            </xs:element>
            <xs:element name="Time">
                <xs:simpletype>
                    <xs:restriction base="integer">
                        <xs:pattern value="[0-9]{13}"/>
                    </xs:restriction>
                </xs:simpletype>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="ROOTabega">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Observation_Time" type="DateTime"/>
                <xs:element name="Actual_Time" type="DateTime"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

The error points to the simpleType right under the <xs:element name="TimeZone" default="GMT"> node. What have I done wrong?

If it matters, I'm mainly using the validator here:
https://www.liquid-technologies.com/online-xsd-to-xml-converter

Other validators I've tried point to the same line with similar (or less readable) errors.


Solution

  • It's a silly typo, I'm afraid: simpletype should be simpleType.