Q: What if my question is not answered here or on the Wiki?
Expand | ||
---|---|---|
| ||
Multiple options exist to support the use of Daffodil or the creation of DFDL schemas for use with Daffodil: Mailman XMPP Chat Bug/Issue Tracker |
Q: When should I use an XSD facet like maxLength, and when should I use the DFDL length property?
...
Expand | |||||
---|---|---|---|---|---|
| |||||
In general, no. The dfdl:assert statement annotation should be used to guide the parser. It should test things that must be true in order to successfully parse the data and create an Infoset from it. But, it should not be used to insure ensure validation of the values of the data elements. By way of illustrating what not to do, it is tempting to put facet constraints on simple type definitions in your schema, and then use a dfdl:assert like this:
so that the parser will validate as it parses, and will fail to parse values that do not satisfy the facet constraints. Don't do this. Your schema will not be as useful because it will not be able to be used for some applications, for example, applications that want to accept well-formed, but invalid data and analyze, act, or report on the invalid aspects. In some sense, embedding checks like this into a DFDL schema is second-guessing the application's needs, and assuming the application does not even want to successfully parse and create an infoset from data that does not obey the facet constraints. |
...