tweety
tweety

Reputation: 31

Is there a way to remove magic numbers from a XML Schema?

I have a WSDL with some types defined. Some elements accept lists of elements and on the service return I also have elements with list of values (or other elements).

As a result I have some magic numbers in the XSD (e.g. minOccurs="10", maxOccurs="250" etc). These values 10, 250 etc are repeated throughout the XSD types.

Is there a way to declare them as some sort of constants? and then reuse them by name for the minOccurs and maxOccurs attributes?

Upvotes: 3

Views: 234

Answers (2)

Michael Kay
Michael Kay

Reputation: 163587

XSD is XML so you could use entities defined in a DTD:

minOccurs="&minOccurs;"

Upvotes: 0

xcut
xcut

Reputation: 6349

No there isn't. The only thing you could do is to pre-process the schema using some sort of template processor before loading.

Upvotes: 1

Related Questions