How to add Max Length to Person Name?

Using a "Constraint Schema" one simply takes a copy of the native NIEM schema subset and modifies the base type as required.  The follow example from step 1 to 4 will show how you can max out the length of a person name.

Example:

Use Case: Add Max Length to nc:PersonGivenName

Step 1:

Copy "subset" directory to a new directory called something like "constraint"

Step 2:

Modify all extension and document schemas to point at "constraint" directory instead of "subset" directory.

Step 3:

Edit ./constraint/niem/niem-core/2.x/niem-core.xsd to add your constraints

...

...

...

<xsd:element name="PersonGivenName" type="nc:PersonNameTextType">

<xsd:element name="PersonGivenName" type="nc:NewNameTextType">

<xsd:annotation>

<xsd:documentation>A first name of a person.</xsd:documentation>

</xsd:annotation>

</xsd:element>

...

...

...

<xsd:complexType name="NewNameTextType">

<xsd:annotation>

<xsd:documentation>Special restricted name text type.</xsd:documentation>

</xsd:annotation>

<xsd:simpleContent>

<xsd:extension base="nc:restricted-string">

<xsd:attributeGroup ref="s:SimpleObjectAttributeGroup"/>

</xsd:extension>

</xsd:simpleContent>

</xsd:complexType>

<xsd:simpleType name="restricted-string">

<xsd:restriction base="xsd:string">

<xsd:maxLength value="10"/>

</xsd:restriction>

</xsd:simpleType>

...

...

...

Use <xsd:pattern/> with a regex expression instead of <xsd:maxLength/> for any more complex validation.

If a lot of constraints are being added, you may want to add the constrained data types to a new schema file and simply import the file so as to minimize the changes directly to the niem-core.xsd file.

Step 4 (DO NOT SKIP THIS STEP):

Test and document changes. . . .ANY TIME you update the subset (yes this happens A LOT), you will need to reapply the constraints, so it is CRITICAL to document what constraints you added.