[DFDL-WG] unordered sequence with constrained occurrences
Garriss Jr., James P.
jgarriss at mitre.org
Tue Mar 5 11:19:06 EST 2013
Hmmm, maybe not. I said:
> The unordered sequence can be modeled with a data array
Yet when implemented in MBTK, it throws a fatal error:
fatal: CTDP3148E: Infinite loop at offset 3: The DFDL parser cannot process array element 'ABCarray' because maxOccurs is unbounded and the length of the previous occurrence was zero.
I think what happens is that on the last pass through the array, it doesn't find a, b, or c, so it throws a fatal error.
So is this a bug in MBTK? Or can DFDL not model an unordered sequence? Or am I just doing it wrong?
Here's a sample DFDL schemas that illustrates the point:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:fmt="http://www.ibm.com/dfdl/GeneralPurposeFormat"
xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.ibm.com/dfdl/GeneralPurposeFormat"
schemaLocation="IBMdefined/GeneralPurposeFormat.xsd" />
<xsd:element ibmSchExtn:docRoot="true" name="ABC">
<xsd:complexType>
<xsd:sequence dfdl:separator="">
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:sequence />
</xsd:appinfo>
</xsd:annotation>
<xsd:element dfdl:occursCountKind="implicit" maxOccurs="unbounded"
minOccurs="1" name="ABCarray">
<xsd:complexType>
<xsd:sequence dfdl:separator="">
<xsd:element dfdl:length="1" dfdl:lengthKind="explicit"
dfdl:occursCountKind="implicit" fixed="a" minOccurs="0" name="a"
type="xsd:string" />
<xsd:element dfdl:length="1" dfdl:lengthKind="explicit"
dfdl:occursCountKind="implicit" fixed="b" minOccurs="0" name="b"
type="xsd:string" />
<xsd:element dfdl:length="1" dfdl:lengthKind="explicit"
dfdl:occursCountKind="implicit" fixed="c" minOccurs="0" name="c"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format ref="fmt:GeneralPurposeFormat" />
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Test with "abc" as sample input.
From: Garriss Jr., James P.
Sent: Tuesday, March 05, 2013 8:43 AM
To: dfdl-wg at ogf.org
Subject: unordered sequence with constrained occurrences
Suppose text data has 3 constructs: a, b, and c.
* a must occur 1 time
* b can occur 0 or 1 time
* c can occur any number of times, 0 or more
These 3 constructs can appear in any order.
So these are valid inputs:
abc
a
bcccca
But these are not:
ccbcc
abbc
abcabc
Can data like this be modeled with DFDL?
The unordered sequence can be modeled with a data array, like this:
Array (0 to unbounded)
Sequence
a (0 to 1)
b (0 to 1)
c (0 to 1)
/Sequence
/Array
But I don't know how to constrain the total number of occurrences.
Appreciate any ideas!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130305/71ec7272/attachment-0001.html>
More information about the dfdl-wg
mailing list