
Good question. I call this type of validation 'cross-field validation' because ( unlike XML Schema validation ) it involves the value or count of more than one field. It's quite common in industry messaging standards. The general answer is as follows: DFDL is based on XML Schema, so its validation facilities don't include cross-field validation. However, by using DFDL to convert to DOM/XML you can bring your non-XML data within reach of whole lot of tools and technologies that were originally designed for XML. I'm thinking about XPath, XQuery, Schematron, RELAX-NG etc. This should not be viewed as a shortcoming of the DFDL language - DFDL is for describing the format, not the higher-level validation rules. Having said that, I wouldn't be surprised if, with sufficient ingenuity, it was possible to make DFDL do what you need in this particular case. Let's see if any suggestions are forthcoming... regards, Tim Kimber, DFDL Team, Hursley, UK Internet: kimbert@uk.ibm.com Tel. 01962-816742 Internal tel. 37246742 From: "Garriss Jr., James P." <jgarriss@mitre.org> To: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>, Date: 20/06/2013 16:34 Subject: [DFDL-WG] How to specify type/subtype combos? Sent by: dfdl-wg-bounces@ogf.org Content types come in pairs. So while the type can be “text” and the subtype can be “pdf”, the complete content type cannot be “text/pdf”. It can, however, be “text/html” or “application/pdf”. So in my DFDL it’s not sufficient to specify enumerated lists for types and subtypes (as I have done below), I must also specify which types are allowed to go with which subtypes. How would I do that, given this complexType? TIA! <xsd:complexType name="MimeTypeType"> <xsd:sequence dfdl:separator="/"> <xsd:element name="Type" dfdl:initiator=""> <xsd:annotation> <xsd:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/ "> <dfdl:assert test="{ dfdl:checkConstraints(.) }" message="The type must match one of the values on the enumerated list."/> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value= "([a|A][p|P][p|P][l|L][i|I][c|C][a|A][t|T][i|I][o|O][n|N])| ([m|M][u|U][l|L][t|T][i|I][p|P][a|A][r|R][t|T])| ([m|M][e|E][s|S][s|S][a|A][g|G][e|E])| ([t|T][e|E][x|X][t|T])" /> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="Subtype" dfdl:terminator=""> <xsd:annotation> <xsd:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/ "> <dfdl:assert test="{ dfdl:checkConstraints(.) }" message="The subtype must match one of the values on the enumerated list." /> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="([p|P][d|D][f|F])| ([a|A][l|L][t|T][e|E][r|R][n|N][a|A][t|T][i|I][v|V][e|E])| ([m|M][i|I][x|X][e|E][d|D])| ([r|R][f|F][c|C]822)| ([p|P][l|L][a|A][i|I][n|N])| ([h|H][t|T][m|M][l|L])" /> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> -- dfdl-wg mailing list dfdl-wg@ogf.org https://www.ogf.org/mailman/listinfo/dfdl-wg Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU