Schemas/NIST-ITL
From Code Synthesis Wiki
Revision as of 15:33, 28 March 2009 Boris (Talk | contribs) (Create a page for NIST-ITL schema) ← Previous diff |
Revision as of 15:43, 28 March 2009 Boris (Talk | contribs) Next diff → |
||
Line 7: | Line 7: | ||
This is caused by two schemas (ansi-nist.xsd and ansi-nist_itl_constraint.xsd) that define the same set of types and both being imported in different places. For background and more information on this issue, see the [http://codesynthesis.com/pipermail/xsd-users/2009-March/002282.html "Compiling NIST-ITL schema with XSD"] thread on the xsd-users mailing list. | This is caused by two schemas (ansi-nist.xsd and ansi-nist_itl_constraint.xsd) that define the same set of types and both being imported in different places. For background and more information on this issue, see the [http://codesynthesis.com/pipermail/xsd-users/2009-March/002282.html "Compiling NIST-ITL schema with XSD"] thread on the xsd-users mailing list. | ||
- | The easiest way to resolve this is to modify the two schemas, niem-code.xsd and jxdm.xsd, to import ansi-nist_itl_constraint.xsd instead of ansi-nist.xsd. With this change the ITL schema can be compiled in the file-per-type mode without any problems. It is also possible to achive the same effect without modifying the schemas. During compilation you can use the --location-map option of the XSD compiler to re-map ansi-nist.xsd to ansi-nist_itl_constraint.xsd. If you enable XML Schema validation during parsing then you will also need to setup you own XML-to-DOM parsing and install a custom entity resolver which opens ansi-nist_itl_constraint.xsd instaed of ansi-nist.xsd when requested by the parser. | + | The easiest way to resolve this is to modify the niem-code.xsd and jxdm.xsd schemas to import ansi-nist_itl_constraint.xsd instead of ansi-nist.xsd. With this change the ITL schema can be compiled in the file-per-type mode without any problems. It is also possible to achive the same effect without modifying the schemas. During compilation you can use the --location-map option of the XSD compiler to re-map ansi-nist.xsd to ansi-nist_itl_constraint.xsd. If you enable XML Schema validation during parsing then you will also need to setup you own XML-to-DOM parsing and install a custom entity resolver which opens ansi-nist_itl_constraint.xsd instaed of ansi-nist.xsd when requested by the parser. |
Another issue with ITL schema is that it uses substitution groups as some sort of application-significant IDs rather than just a way to specify the element types. For example, elements PackageUserDefinedImageRecord, PackageLantentImageRecord, etc., all substitute PackageDataRecord but are all of the same PackageImageRecordType type. During serialization the generated code uses type information to automatically figure out which element name to use based on the substitution group information in the schema. As a result, the generated code always uses the first element name from the above group since the object type | Another issue with ITL schema is that it uses substitution groups as some sort of application-significant IDs rather than just a way to specify the element types. For example, elements PackageUserDefinedImageRecord, PackageLantentImageRecord, etc., all substitute PackageDataRecord but are all of the same PackageImageRecordType type. During serialization the generated code uses type information to automatically figure out which element name to use based on the substitution group information in the schema. As a result, the generated code always uses the first element name from the above group since the object type |
Revision as of 15:43, 28 March 2009
This page contains information on using the ANSI/NIST-ITL (Data Format for the Interchange of Fingerprint, Facial, & Other Biometric Information) schema with XSD.
When trying to compile the 2007f version of this schema with XSD C++/Tree mapping, you may get the following error:
type 'http://niem.gov/niem/ansi-nist/2.0:FingerprintType' is not found
This is caused by two schemas (ansi-nist.xsd and ansi-nist_itl_constraint.xsd) that define the same set of types and both being imported in different places. For background and more information on this issue, see the "Compiling NIST-ITL schema with XSD" thread on the xsd-users mailing list.
The easiest way to resolve this is to modify the niem-code.xsd and jxdm.xsd schemas to import ansi-nist_itl_constraint.xsd instead of ansi-nist.xsd. With this change the ITL schema can be compiled in the file-per-type mode without any problems. It is also possible to achive the same effect without modifying the schemas. During compilation you can use the --location-map option of the XSD compiler to re-map ansi-nist.xsd to ansi-nist_itl_constraint.xsd. If you enable XML Schema validation during parsing then you will also need to setup you own XML-to-DOM parsing and install a custom entity resolver which opens ansi-nist_itl_constraint.xsd instaed of ansi-nist.xsd when requested by the parser.
Another issue with ITL schema is that it uses substitution groups as some sort of application-significant IDs rather than just a way to specify the element types. For example, elements PackageUserDefinedImageRecord, PackageLantentImageRecord, etc., all substitute PackageDataRecord but are all of the same PackageImageRecordType type. During serialization the generated code uses type information to automatically figure out which element name to use based on the substitution group information in the schema. As a result, the generated code always uses the first element name from the above group since the object type is the same.
One way to overcome this is to customize the xml_schema::type class (which is a base for all generated types) by adding a custom type_id member (which is just the substituting element name). This type_id is automatically extracted during parsing, can be queried/modified by the application, and is used during serialization to make sure the right element name is used. With this change the serialized XML is equivalent to the original.
The following two packages contain the fixed-up NIST-ITL 2007f schemas, custom xml_schema::type implementation, the test driver, XSD option files, as well as the README file which explains how to compile everything: