You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by Roger L Costello <co...@mitre.org> on 2021/04/19 19:34:19 UTC

A question about separatorSuppressionPolicy

Hi Folks,

My instance document consists of a sequence of up to 5 strings, separated by forward slash, e.g., 

	/a//

If I specify separatorSuppressionPolicy="trailingEmpty" then I can specify minOccurs="0" maxOccurs="5"

If I specify separatorSuppressionPolicy="anyEmpty" then I get this error: 

      Left over data. Consumed 0 bit(s) with at least 56 bit(s) remaining.

Why is that?

That is, why does this work:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
            dfdl:separatorSuppressionPolicy="trailingEmpty">
        <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="5" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Whereas this doesn't:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
            dfdl:separatorSuppressionPolicy="anyEmpty">
        <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="5" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

The latter works if I specify minOccurs="1" maxOccurs="5"

/Roger

Re: A question about separatorSuppressionPolicy

Posted by "Beckerle, Mike" <mb...@owlcyberdefense.com>.
I can reproduce this.

The answer to your question about why this is... is "due to bug(s)" in 3.0.0

The fix to https://issues.apache.org/jira/browse/DAFFODIL-2487 probably also fixed this issue for 3.1.0.

On Daffodil 3.1.0 (a development branch), both tests work and produce the same infoset
<file><value>a</value></file>

On Daffodil 3.0.0, the anyEmpty variant fails. I am not sure why yet, turning on daffodil 3.0.0 trace was decidedly unhelpful.

The change to minOccurs="1" allows 3.0.0 to produce an infoset, which looks correct. It is the same thing you get from Daffodil 3.1.0 (a development branch) for this case (with minOccurs="1")

<ex:file2 xmlns:ex="http://example.com">
  <value></value>
  <value>a</value>
</ex:file2>

So clearly there is a bug in 3.0.0 fixed in 3.1.0 (dev branch).

I have incorporated your test case into a test for Daffodil, to insure no future regression on this:
https://issues.apache.org/jira/browse/DAFFODIL-2498
<https://github.com/apache/daffodil/pull/533>



________________________________
From: Roger L Costello <co...@mitre.org>
Sent: Monday, April 19, 2021 3:34 PM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: A question about separatorSuppressionPolicy

Hi Folks,

My instance document consists of a sequence of up to 5 strings, separated by forward slash, e.g.,

        /a//

If I specify separatorSuppressionPolicy="trailingEmpty" then I can specify minOccurs="0" maxOccurs="5"

If I specify separatorSuppressionPolicy="anyEmpty" then I get this error:

      Left over data. Consumed 0 bit(s) with at least 56 bit(s) remaining.

Why is that?

That is, why does this work:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
            dfdl:separatorSuppressionPolicy="trailingEmpty">
        <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="5" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

Whereas this doesn't:

  <xs:element name="file">
    <xs:complexType>
      <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix"
            dfdl:separatorSuppressionPolicy="anyEmpty">
        <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="5" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

The latter works if I specify minOccurs="1" maxOccurs="5"

/Roger