Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the attributes 'final' and 'block' mean in XSD?

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?

like image 759
Chong Lip Phang Avatar asked Dec 14 '22 19:12

Chong Lip Phang


1 Answers

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.

like image 160
Ian Roberts Avatar answered Dec 28 '22 06:12

Ian Roberts