4

Is it possible to override the minOccurs & maxOccurs attribute of an element in complexType by extension?

I have a xsd for a application configuration and I want to extend the complextype to make the attributes optional and get only the elements that are modified by the user in GUI. Since I don't want to send all the elements to server for just one option change.

Please help.

1 Answers1

2

Extension allows you to specify additional elements/attributes, it does not allow you to change the cardinality/facets etc of child elements/attributes.

Restriction works the other way it allows to to further restrict existing elements/attributes, so if you wanted to make an optional element mandatory you could do that with a restriction.

So basically no - an extension will not allow you to change existing child elements.

The only way to do this is using the redefine construct - but this is messy and is not very well supported by some validating parsers.

Sprotty
  • 5,676
  • 3
  • 33
  • 52