Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-682

Daffodil doesn't appear to check constraints

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • s10
    • None
    • None
    • None
    • Win 7, 0.9

      Added checkConstraint() to an element. If the input is good, no problem. When the input is bad, the error message doesn't have anything to do with the checkConstraint. I can't tell if the checkConstraint is failing, or if some other bug prevents it from running.

      Date: Mon <--- Works fine
      Date: XYZ <--- Throws unexpected error

      Parse Error: Term('%NL;') - element.Date: Delimiter not found!
      Schema context: element.Date Location in file:/C:/Users/jgarriss/Documents/DFDL_Schemas_Email/02_Message_Headers/CheckConstraint.xsd
      Data location was preceding byte 6
      UTF-8 text starting at byte 0 is: (Date: XYZ
      )
      Data (hex) starting at byte 0 is: (0x446174653A2058595A0A)

      Expected error: Invalid day of the week. The delimiter is not the problem. It's there and is found if the day of the week is correct.

      Here's the schema:

      <?xml version="1.0" encoding="UTF-8"?>
      <xsd:schema xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
      	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      	
      	<xsd:include
      		schemaLocation="C:\Users\jgarriss\Documents\DFDL_Schemas_Email\02_Message_Headers\DefaultProperties.xsd"/>
      	<xsd:annotation>
      		<xsd:appinfo source="http://www.ogf.org/dfdl/">
      			<dfdl:format ref="DefaultPropertiesFormat"/>
      		</xsd:appinfo>
      	</xsd:annotation>
      	
      	<xsd:element name="Date" dfdl:initiator="Date:%SP;" dfdl:terminator="%NL;">
      		<xsd:complexType>
      			
      			<xsd:sequence dfdl:initiator="" dfdl:separator="%SP;" dfdl:separatorPolicy="suppressed">
      				<xsd:element name="DayOfTheWeek" dfdl:length="3" dfdl:lengthKind="explicit"
      					dfdl:occursCountKind="implicit" minOccurs="0">
      					<xsd:annotation>
      						<xsd:appinfo source="http://www.ogf.org/dfdl/dfdl-1.0/">
      							<dfdl:assert test="{ dfdl:checkConstraints(.) }"
      								message="Invalid day of the week"/>
      						</xsd:appinfo>
      					</xsd:annotation>
      					
      					<xsd:simpleType>
      						<xsd:restriction base="xsd:string">
      							<xsd:enumeration value="Mon"/>
      							<xsd:enumeration value="Tue"/>
      							<xsd:enumeration value="Wed"/>
      							<xsd:enumeration value="Thu"/>
      							<xsd:enumeration value="Fri"/>
      							<xsd:enumeration value="Sat"/>
      							<xsd:enumeration value="Sun"/>
      						</xsd:restriction>
      					</xsd:simpleType>
      				</xsd:element>
      				
      			</xsd:sequence>
      		</xsd:complexType>
      	</xsd:element>
      </xsd:schema>

              aseyler Andrew Seyler
              james.garriss James Garriss
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: