A facet constrains the range of allowable values for simple content.
In NIEM, the most commonly used facets are enumerations (code values). Other examples of a facet include pattern, minLength, and maxExclusive.
| Variable | Description | Usage | NDR Reference |
|---|---|---|---|
{$Name} |
Name of the code type | Required | NDR Section 10.8: Naming Rules |
{$Definition} |
The definition of the code type | Required | NDR Rule 9-12: Simple type has definition NDR Rule 9-25: Complex type has definition |
{$XSDBase} |
The Schema built-in type that the simple code type is restricting | Required; often "xs:token" | |
{$Facet} |
The kind of facet. See "Facet" column in table below for values. | Required. Repeat facet block for each facet value. | |
{$FacetValue} |
The value of the facet | Required | |
{$FacetDefinition} |
The definition of the facet | Required |
| Facet | Description | Text | Numeric | Date |
|---|---|---|---|---|
| enumeration | An allowable value (a code). | X | X | X |
| fractionDigits | The maximum number of decimal places allowed. | X | ||
| length | The number of characters of a value. | X | ||
| maxLength | The maximum number of characters of a value. | X | ||
| minLength | The minimum number of characters of a value. | X | ||
| minExclusive | The lower bound - the number must be greater than this constraint. | X | X | |
| minInclusive | The lower bound - the number must be greater than or equal to this constraint. | X | X | |
| maxExclusive | The upper bound - the number must be less than this constraint. | X | X | |
| maxInclusive | The upper bound - the number must be less than or equal to this constraint. | X | X | |
| pattern | The regular expression that the value must match. | X | X | X |
| totalDigits | The maximum number of digits allowed. | X | ||
| whiteSpace | The way white space (spaces, tabs, line feeds, carriage returns) will be handled. | X |
<xs:simpleType name="{$Name}SimpleType">
<xs:annotation>
<xs:documentation>A data type for a(n) {$Definition}</xs:documentation>
</xs:annotation>
<xs:restriction base="{$XSDBase}">
<xs:{$Facet} value="{$FacetValue}">
<xs:annotation>
<xs:documentation>{$FacetDefinition}</xs:documentation>
</xs:annotation>
</xs:{$Facet}>
</xs:restriction>
</xs:simpleType>