Hi Folks,

My input consists of one field terminated by //

The value of the field is either foo or bar.

Here is a sample input:

foo//

My DFDL schema works fine with that input.

The field is nillable and the nilValue is a hyphen. Here is a valid input:

-//

My DFDL schema fails with that input.

I specify the field using dfdl:lengthKind="pattern" and 
dfdl:lengthPattern="foo|bar"

Below is my DFDL schema. Am I doing something wrong or is this a bug in 
Daffodil? If so, is there a workaround?  /Roger

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"; elementFormDefault="qualified"> 
    <xs:annotation>
        <xs:appinfo source="http://www.ogf.org/dfdl/";>
            <dfdl:format
                alignment="1"
                alignmentUnits="bytes"
                emptyValueDelimiterPolicy="none"
                encoding="ASCII"
                encodingErrorPolicy="replace"
                escapeSchemeRef=""
                fillByte="%SP;"
                floating="no"
                ignoreCase = "yes"
                initiatedContent="no"
                initiator = ""
                leadingSkip="0"
                lengthKind = "delimited" 
                lengthUnits="characters"
                nilKind="literalValue"
                nilValue="-"
                nilValueDelimiterPolicy="none"
                occursCountKind="implicit"
                outputNewLine="%CR;%LF;"
                representation="text"
                separator=""
                separatorSuppressionPolicy="anyEmpty"
                sequenceKind="ordered"
                textBidi="no" 
                textPadKind="none"
                textTrimKind="none"
                trailingSkip="0"  
                truncateSpecifiedLengthString="no"
                terminator = ""
                textNumberRep="standard"
                textStandardBase="10"
                textStandardZeroRep="0"
                textNumberRounding="pattern"
                textStandardExponentRep="E"
                textNumberCheckPolicy="strict"
            />
        </xs:appinfo>
    </xs:annotation>

    <xs:element name="Test" dfdl:terminator="//">
        <xs:complexType>
            <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix">     
     
                <xs:element name="A" type="non-zero-length-string" 
nillable="true" 
                                      dfdl:lengthPattern="foo|bar" 
dfdl:nilValue="-" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <xs:simpleType name="non-zero-length-string" dfdl:lengthKind="pattern">
        <xs:annotation>
            <xs:appinfo source="http://www.ogf.org/dfdl/";>
                <dfdl:assert test="{ . ne '' }"/>
            </xs:appinfo>
        </xs:annotation>
        <xs:restriction base="xs:string"/>
    </xs:simpleType>

</xs:schema>

Reply via email to