Hi Folks,


I am creating a DFDL schema for this category of field:



Fixed length, nillable, not composite, choice



My input contains data about a runway. The field is fixed length(7), nillable 
(hyphen), and a choice of non-composite values. Here are sample inputs:



.../24L-36R/...

.../24L    /...

.../   -   /...



The first two samples work, the last one fails and Daffodil reports:



[error] Parse Error: All choice alternatives failed. Reason(s): List(Parse 
Error: Alternative failed. Reason(s): List(Parse Error: Assertion failed: { 
fn:nilled(.) } failed



My DFDL schema employs the techniques that Mike and Steve gave last week: make 
the choice branch for the nil value first, and use checkConstraints(). So why 
am I getting the error? How do I fix it?



Second question: The top-level element (RunwayWrapper) contains just these two 
properties:



dfdl:lengthKind="explicit"

dfdl:length="7"



I thought that I should also be able to also specify these properties on the 
top-level element:



dfdl:textTrimKind="padChar"

dfdl:textPadKind="padChar"

dfdl:textStringPadCharacter="%SP;"

dfdl:textStringJustification="left"



But Daffodil ignores those properties and generates this warning message (and 
others):



[warn] Schema Definition Warning: DFDL property was ignored: 
textPadKind="padChar"



Why can't I put those properties on the top-level element?



Here is my DFDL schema:



<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/";

    xmlns:xs="http://www.w3.org/2001/XMLSchema";

    xmlns:fn="http://www.w3.org/2005/xpath-functions";>

    <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"

                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">

        <xs:complexType>

            <xs:sequence dfdl:separator="/" dfdl:separatorPosition="infix">

                <xs:element name="A" type="xs:string" />

                <xs:element name="RunwayWrapper"

                                      dfdl:lengthKind="explicit"

                                      dfdl:length="7">

                    <xs:complexType>

                        <xs:choice dfdl:choiceLengthKind="implicit">

                            <xs:element name="RunwayNum_" type="xs:string"

                                                   nillable="true"

                                                   dfdl:nilKind="literalValue"

                                                   dfdl:nilValue="%WSP*;-">

                                <xs:annotation>

                                    <xs:appinfo 
source="http://www.ogf.org/dfdl/";>

                                        <dfdl:assert>{ fn:nilled(.) 
}</dfdl:assert>

                                    </xs:appinfo>

                                </xs:annotation>

                            </xs:element>

                            <xs:element name="RunwayNum">

                                <xs:complexType>

                                    <xs:choice dfdl:choiceLengthKind="implicit">

                                        <xs:element name="RunwayShort"

                                                               
dfdl:textTrimKind="padChar"

                                                               
dfdl:textPadKind="padChar"

                                                               
dfdl:textStringPadCharacter="%SP;"

                                                               
dfdl:textStringJustification="left">

                                            <xs:annotation>

                                                <xs:appinfo 
source="http://www.ogf.org/dfdl/";>

                                                    <dfdl:assert 
message="Invalid RunwayShort value">{ dfdl:checkConstraints(.) }</dfdl:assert>

                                                </xs:appinfo>

                                            </xs:annotation>

                                            <xs:simpleType>

                                                <xs:restriction 
base="xs:string">

                                                    <xs:pattern 
value="[0-9]{2,2}(C|L|R){0,1}"/>

                                                </xs:restriction>

                                            </xs:simpleType>

                                        </xs:element>

                                        <xs:element name="RunwayLong"

                                                               
dfdl:textTrimKind="padChar"

                                                               
dfdl:textPadKind="padChar"

                                                               
dfdl:textStringPadCharacter="%SP;"

                                                               
dfdl:textStringJustification="left">

                                            <xs:annotation>

                                                <xs:appinfo 
source="http://www.ogf.org/dfdl/";>

                                                    <dfdl:assert 
message="Invalid RunwayLong value">{ dfdl:checkConstraints(.) }</dfdl:assert>

                                                </xs:appinfo>

                                            </xs:annotation>

                                            <xs:simpleType>

                                                <xs:restriction 
base="xs:string">

                                                    <xs:pattern 
value="[0-9]{2,2}(C|L|R){0,1}-[0-9]{2,2}(C|L|R){0,1}"/>

                                                </xs:restriction>

                                            </xs:simpleType>

                                        </xs:element>

                                    </xs:choice>

                                </xs:complexType>

                            </xs:element>

                        </xs:choice>

                    </xs:complexType>

                </xs:element>

                <xs:element name="B" type="xs:string" />

            </xs:sequence>

        </xs:complexType>

    </xs:element>

</xs:schema>

Reply via email to