0
votes

I have an XSD like this:

<xs:complexType name="ItemBase" abstract="true">
</xs:complexType>

<xs:complexType name="ContentItemBase" abstract="true">
  <xs:complexContent>
    <xs:extension base="ItemBase">
        <xs:attributeGroup ref="path" />
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:attributeGroup name="path">
  <xs:attribute name="path" type="xs:string" use="required" />
  [...]
</xs:attributeGrou>

+ Various complex types derived from ContentItemBase, especially this one:
<xs:complexType name="FileItem">
  <xs:complexContent>
    <xs:extension base="ContentItemBase">
      <xs:sequence>
        [...]
      </xs:sequence>
  </xs:extension>
</xs:complexContent>

Now I want to add an attribute restriction on the "path" attribute BUT for FileItem only, not for other derived complex types of ContentItemBase.

How to add attribute restrictions to an attribute group which has been defined further up the complex type hierarchy?

1

1 Answers

0
votes

You can't extend and restrict in a single step. You need to define FileItem0 as an extension of ContentItemBase, and then define FileItem as a restriction of FileItem0; you can restrict the attribute simply by re-declaring it with a new type, so long as the new type is a valid restriction of the base type.