[DFDL-WG] How to specify type/subtype combos?
Garriss Jr., James P.
jgarriss at mitre.org
Thu Jun 20 11:33:54 EDT 2013
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130620/610e164f/attachment.html>
More information about the dfdl-wg
mailing list