I'm getting the error:
unexpected attribute "guid"
when using the schema below.
There is a definition used as a "supertype" (FilesetType) and two other
types are based on it: "RulesetType" and "EnumsetType"
But both require the guid attribute, since the attributed is defined in the
"supertype".
The document to get the error would look something like:
<package>
<filesets>
<enumset guid="CAFECAFECAFECAFE" name="something"
description="something/>
<ruleset guid="CAFECAFECAFECAFE" name="something"
description="something>
<load resource="\some\path\here"/>
</ruleset>
</filesets>
</package>
Here is the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://www.acme.com/xml/schemas"
xmlns="
http://www.acme.com/xml/schemas"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xsd:element name="package" type="PDType"/>
<xsd:complexType name="PDType">
<!-- Sequenced entities -->
<xsd:all>
... some definitions removed ...
<xsd:element name="filesets" type="ContainerType" minOccurs="0"/>
</xsd:all>
... some definitions removed...
</xsd:complexType>
<xsd:complexType name="ContainerType">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="enumset" type="EnumsetType"/>
<xsd:element name="ruleset" type="RulesetType"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="FilesetType">
<xsd:attribute name="guid" type="GUIDType" use="required"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="description" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="RulesetType">
<xsd:complexContent>
<xsd:extension base="FilesetType">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="load" type="LoadType"/>
<xsd:element name="check" type ="CheckType"/>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="EnumsetType">
<xsd:complexContent>
<xsd:extension base="FilesetType">
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LoadType">
<xsd:attribute name="resource" type="xsd:anyURI" use="required"/>
</xsd:complexType>
<xsd:complexType name="CheckType">
<xsd:attribute name="resource" type="xsd:anyURI" use="required"/>
<xsd:attribute name="size" type="xsd:nonNegativeInteger"
use="optional"/>
</xsd:complexType>
<xsd:simpleType name="GUIDType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-F0-9]{16,16}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>