Unfortunately, DFDL does not support that kindof validation. You would need to
use some other validation mechanism (e.g. XSLT, schematron, relaxng, a custom
tool).
Note that as an alternative to XSD validation, Daffodil also supports schematron
validation, which I think can do this kind of uniqueness check. We support
schematron either embedded in the DFDL schema or an external .sch file. For
example, you can do:
daffodil parse --validate schematron=<sch> ...
Where <sch> is a path to the DFDL schema with embedded schematron rules or an
external schematron file. For reference, here's a DFDL schema with schematron
rules embedded as annotations that we use for testing:
https://github.com/apache/daffodil/blob/main/daffodil-schematron/src/test/resources/xsd/unit_price.dfdl.xsd
Daffodil also supports pluggable validators, so you could also make a custom
validator if you wanted.
There isn't great documentation around this, but here are some tests/examples of
using a custom validator in Java:
https://github.com/apache/daffodil/blob/main/daffodil-japi/src/test/java/org/apache/daffodil/example/ValidatorApiExample.java
- Steve
On 2024-12-17 09:12 AM, Mark Kozak wrote:
Good morning community,
I realize this ask may be a stretch, but I thought it would be worth an ask.
Suppose I have a CSV file as shown below:
32, 1,7,99
17, 12
I would like to have some form of validation that each of those values only
appears once. The following is a counter example where I would want to get a
validation error because 32 appears twice.
32, 1,7,99
17, 12
2, 32, 19
Is this something that is doable with DFDL schemas? Or is that out of scope?
Thanks in advance for any shared wisdom.
Mark Kozak
Director of Engineering
Adeptus Cyber Solutions
Adeptus-CS.com