I think this fails because you have lengthKind 'delimited' but there is no
delimiter specified for your latitude nor longitude element.

You intended the lat/lon fields to be fixed length yes?

So when parsing the latitude, it grabs all text as far as it can until some
enclosing delimiter is reached, and then this fails pattern validation.

But parsing is off the rails at that point.

I suggest this style for all your fixed length strings:

<simpleType name="fixedLengthString" dfdl:lengthKind="explicit">
   <restriction base="xs:string"/>
 </simpleType>

Then always use this type for your fixed length strings. Each will have to
specify dfdl:length="2" or whatever the fixed length is.
But you'll get an SDE if you leave that off.



On Thu, Aug 18, 2022 at 11:09 AM Roger L Costello <coste...@mitre.org>
wrote:

> Hi Folks,
>
> Daffodil is unable to parse DFDL schemas containing two consecutive
> element declarations, each with a simpleType which has a facet.
>
> With this input:
>
> John Doe/2006/Sally Smith
>
> The part of interest is the middle part - 2006 - which consists of two
> subparts: 20 (LatitudeDegrees) and 06 (LatitudeMinutes). Each subpart is
> constrained via XSD facets.
>
> I get this error message when I parse using Daffodil version 3.2.1 (using
> the -V limited option):
>
> [error] Validation Error: LatitudeMinutes failed facet checks due to:
> facet enumeration(s): 06
>
> Below is my DFDL schema.
>
> I believe this is a bug, yes? Is there a workaround?
>
> <xs:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"; xmlns:xs="
> http://www.w3.org/2001/XMLSchema";>
>     <xs:annotation xmlns:f="function" xmlns:fn="
> http://www.w3.org/2005/xpath-functions"; xmlns:regex="regex-functions">
>         <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="Origin">
>                     <xs:complexType>
>                         <xs:sequence dfdl:separator="">
>                             <xs:element name="LatitudeDegrees">
>                                 <xs:simpleType>
>                                     <xs:restriction base="xs:string">
>                                         <xs:pattern value="[0-9]{2}"/>
>                                     </xs:restriction>
>                                 </xs:simpleType>
>                             </xs:element>
>                             <xs:element name="LatitudeMinutes">
>                                 <xs:simpleType>
>                                     <xs:restriction base="xs:string">
>                                         <!--<xs:pattern
> value="[0-9]{2}"/>-->  <!-- This also fails -->
>                                         <xs:enumeration value="06" />
>                                     </xs:restriction>
>                                 </xs:simpleType>
>                             </xs:element>
>                         </xs:sequence>
>                     </xs:complexType>
>                 </xs:element>
>                 <xs:element name="B" type="xs:string" />
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> </xs:schema>
>
>
>

Reply via email to