Reference vs. Extension Schema

The NIEM Naming and Design Rules version 4.0 defines two classes of conformant XML Schema documents:

  • REF: Reference schema document: a schema document that is intended to provide the authoritative definitions of broadly reusable schema components.
  • EXT: Extension schema document: a schema document that is intended to provide definitions of schema components that are intended for reuse within a more narrow scope than those defined by a reference schema document.

Rules

The following sections outline differences in NDR rules between REF and EXT schema documents.

Conformance targets

REF and EXT schema documents have different conformance target identifiers. All REF and EXT schema documents must have a conformance target identifier, which tells readers of the schema what class of schema document it is. The conformance target identifiers are different for REF and EXT. These two rules identify the conformance target for each type of schema document.

Extension and restriction

REF schema documents must use xs:extension to derive complex types. EXT schema documents are allowed to use xs:restriction for complex types. These rules require xs:extension for REF schemas. EXT schema documents are allowed to use xs:extension and xs:restriction.

These rules ensure that REF and EXT have xs:sequence as the top-level model compositors; they are different rules because REF requires xs:extension, while EXT also allows xs:restriction

Block and final

REF schema documents are not allowed to use block and final, which restrict extension and reuse of elements and complex types. EXT schemas are allowed to use these. These restrictions are placed on elements, complex types and on the schema, where defaults are set.

Nillable

REF elements must be nillable.

Choice

EXT schemas are allowed to use xs:choice. REF schemas are not allowed to use xs:choice. (Neither type of schema can use xs:all).

Since REF schemas are not allowed to use xs:choice, these rules are applied only to EXT schemas.

These rules limit cardinality on xs:choice, applicable only to EXT schema documents.

Wildcards

REF schema documents cannot use wildcards.

Augmentation points

REF schema documents must include augmentations on complex types.

External adapters

REF schemas are not allowed to use attributes from external (not NIEM-conformant) schemas. EXT schemas are allowed to reference external attributes.

This rule applies only to REF, but probably should be applied to EXT as well.