[DFDL-WG] clarification needed: assert evaluation order and arrays

Mike Beckerle mbeckerle.dfdl at gmail.com
Thu Nov 1 11:40:26 EDT 2012


Question: If I write

<element name="foo" minOccurs="5" maxOccurs="10"
dfdl:occursCountKind='parsed'>
   <annotation><appinfo...>
      <dfdl:assert>{ dfdl:checkConstraints(.) }</dfdl:assert>
   </appinfo></annotation>
   <simpleType>
     <restriction base="xs:string">
        <pattern value="...some regex..."/>
     </restriction>
   </simpleType>
</element>

I have two sources of constraints. One is the pattern, the other the
min/max occurs.

Does that one assertion calling dfdl:checkConstraints mean both will be
checked?
That is, one check occurring as each element is parsed, and the other at
the end of the array?

Assume I am not using any validation option, so the DFDL processor would
not otherwise check the max/minOccurs because occursCountKind is parsed.

Will the checkConstraints fail as soon as we parse the 11th element (is it
checking the min/max occurs for each element occurrence as it is parsed),
or do we parse as many as we can, and fail only when we check and find out
that the entire array has 36 elements that were successfully parsed?

What I would like the above to mean is this:

1) as each element occurrence is parsed we check the pattern and parse
error (assertion failed) if there is no match.
2) Also after a successful parse of an occurrence, we check that the index
is <=10, and parse-error (assertion failed) if not.
3) at the end of the array, we check that the number of occurrences is >=
5. If not we get a parse error (assertion failed).

Comments?





...mikeb

-- 
Mike Beckerle | OGF DFDL WG Co-Chair
Tel:  781-330-0412
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20121101/671f1edf/attachment.html>


More information about the dfdl-wg mailing list