[DFDL-WG] checkConstraints example?

Steve Hanson smh at uk.ibm.com
Tue Mar 26 07:48:12 EDT 2013


James

dfdl:checkConstraints() does not validate against a specific facet, it 
validates against all facets and the fixed attribute. So it checks that a 
simple element conforms to its simple type.  It does exactly the checks 
that switching on validation would do, but it causes a processing error 
instead of a validation error when it fails, enabling the parser to 
backtrack.

<xsd:element name="DayOfTheWeek“ minOccurs="0" …>
  <xsd:simpleType>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Mon" />
      <xsd:enumeration value="Tue" />
      <xsd:enumeration value="Wed" />
      …
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:annotation>
    <xsd:appinfo source="http://www.ogf.org/dfdl/">
        <dfdl:discriminator>dfdl:checkConstraints()</dfdl:discriminator>
    </xsd:appinfo>
  </xsd:annotation>
</xsd:element>

Regards

Steve Hanson
Architect, IBM Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848



From:   "Garriss Jr., James P." <jgarriss at mitre.org>
To:     "dfdl-wg at ogf.org" <dfdl-wg at ogf.org>, 
Date:   26/03/2013 11:39
Subject:        [DFDL-WG] checkConstraints example?
Sent by:        dfdl-wg-bounces at ogf.org



Can you please supply an example of using checkConstraints to valid an 
enumeration?  There’s not one in the spec, and none of the tutorials I 
have demo this.
 
Suppose I have this DFDL:
 
<xsd:element name="DayOfTheWeek“…>
  <xsd:simpleType>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Mon" />
      <xsd:enumeration value="Tue" />
      <xsd:enumeration value="Wed" />
      …
    </xsd:restriction>
  </xsd:simpleType>
</xsd:element>
 
TIA--
  dfdl-wg mailing list
  dfdl-wg at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130326/f92dc674/attachment.html>


More information about the dfdl-wg mailing list