In XSD, < complextType > can have the attributes 'block' and 'final', which can take a value of #all or a list of extensions or restrictions. What do these attributes mean? How do we use them?
I could not get a clear answer from the W3C recommendation for XSD 1.1. Could someone give me some examples?
As is so often the case with XML Schema, the non-normative "primer" provides a much clearer explanation than the normative specs. In this case the section "controlling the creation and use of derived types" has a worked example of both final
and block
in terms of different types of address.
Essentially, final
means that the type cannot have any subtypes at all (with the appropriate derivation style), whereas block
says that the type can have subtypes but when an element is declared to be of a blocked type then that element must be of the declared type specifically, and not of a subtype.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With