Aladdin
Aladdin

Reputation: 360

Reuse attributes on many elements in XSD

Is there a way in XML Schema to define/name a set of attributes that can be reused on many element definitions without cutting/pasting the whole attribute definition into each element definition?

For example, if I want three attributes on 20 different elements in my xsd, can I name these as a group somehow once and reference them without having to have the same full definition repeated as part of all 20 elements?

<xs:attribute name="lang" type="xs:string" use="required"/>
<xs:attribute name="page" type="xs:string"/>
<xs:attribute name="alphabet" type="xs:string"/> 

Upvotes: 3

Views: 1078

Answers (1)

StuartLC
StuartLC

Reputation: 107277

Yes there is 'xs:attributeGroup' for this purpose.

Upvotes: 4

Related Questions