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