Code Set Pattern

A code set defines an enumerated list of values.

In NIEM, the enumerated values are defined in a simple type. A corresponding complex type with simple content is also created for use by elements (NIEM elements are required to have a complex data type).

Variable Replacement Table

Variable Description Usage NDR Reference
{$Name} Name of the code element / type Required NDR Rule 7-5: Component naming
NDR Section 10.8: Naming Rules
{$Definition} The definition of the code element / type Required NDR Rule 9-12: Simple type has definition
NDR Rule 9-25: Complex type has definition
NDR Rule 9-36: Element has definition
NDR Section 11.6.1: Human-readable documentation
{$XSDBase} The Schema built-in type that the simple code type is restricting Required; often "xs:token"  
{$CodeValue} The enumeration value (e.g., "GA") Required; Repeat enumeration block for each code value  
{$CodeDefinition} The definition of the enumeration (e.g., "Georgia") Required NDR Rule 9-23: Code has definition
{$Nillable} "true", if the property can have a nil value Optional  

Code Set Pattern

<xs:simpleType name="{$Name}CodeSimpleType">
      <xs:documentation>A data type for a(n) {$Definition}</xs:documentation>
  <xs:restriction base="{$XSDBase}">
	<xs:enumeration value="{$CodeValue}">
  <xs:complexType name="{$Name}CodeType">
      <xs:documentation>A data type for a(n) {$Definition}</xs:documentation>
      <xs:extension base="{$Name}CodeSimpleType">
        <xs:attributeGroup ref="structures:SimpleObjectAttributeGroup" />
  <xs:element name="{$Name}Code" type="{$Name}CodeType" nillable="{$Nillable}">
      <xs:documentation>A(n) {$Definition} </xs:documentation>