[DFDL-WG] dfdl:calendarPattern does not seem to do anything

Garriss Jr., James P. jgarriss at mitre.org
Tue Mar 5 10:31:22 EST 2013


I've observed the same problem that Roger observed, and I'm using xs:date.  Consider this element:

<xsd:element dfdl:calendarCheckPolicy="strict"
                  dfdl:calendarPattern="dd MMM yyyy" dfdl:calendarPatternKind="explicit"
                  ibmDfdlExtn:sampleValue="2001-01-01" name="BadDate" type="xsd:date" />

It seems to me that the input date must exactly match the pattern given (the check policy is strict).  If not, then there should be a parse error.  Yet MBTK happily converts this bad input:

9 Feb 13

To

<BadDate xsi:type="xs:date">13-02-11</BadDate>

So either I don't understand the purpose of calendarPattern, or it's not quite working right.

(Maybe someone could test this on Daffodil?)

From: Steve Hanson [mailto:smh at uk.ibm.com]
Sent: Tuesday, March 05, 2013 4:46 AM
To: Costello, Roger L.
Cc: David Hardcastle; Cranford, Jonathan W.; Garriss Jr., James P.
Subject: Re: dfdl:calendarPattern does not seem to do anything

Roger,

Change your data type from xs:string to xs:date, xs:time or xs:dateTime, make sure that dfdl:calendarPatternKind is 'explicit' and then dfdl:calendarPattern will work. This is all covered in the DFDL spec section 13.11.

Regards

Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group<http://www.ogf.org/dfdl/>
IBM SWG, Hursley, UK
smh at uk.ibm.com<mailto:smh at uk.ibm.com>
tel:+44-1962-815848



From:        "Costello, Roger L." <costello at mitre.org<mailto:costello at mitre.org>>
To:        David Hardcastle/UK/IBM at IBMGB, Steve Hanson/UK/IBM at IBMGB,
Cc:        "Cranford, Jonathan W." <jcranford at mitre.org<mailto:jcranford at mitre.org>>, "Garriss Jr., James P." <jgarriss at mitre.org<mailto:jgarriss at mitre.org>>
Date:        04/03/2013 18:21
Subject:        dfdl:calendarPattern does not seem to do anything
________________________________



Hello Steve and David,

Here I use the dfdl:calendarPattern for expressing the day of a month:

<xsd:element                  name="Day"
                                      type="xsd:string"
                                 dfdl:calendarCheckPolicy="strict"
                                 dfdl:calendarPattern="dd"
                                 dfdl:calendarPatternKind="explicit"  />

Note that the pattern says that the input data should consist of 2 digits (dd).

However, when I parse this data:

                xx

or this data:

                 123

the parser says that the data is fine. (Checking the "Validate data against schema" button has no effect)

I conclude the dfdl:calendarPattern does not verify that the data conforms to the specified pattern.

Further, I would have thought that the specified pattern would inform the parser when it has obtained a token, i.e., I shouldn't have to specify a dfdl:terminator on the element since the pattern should inform the parser. Alas, that is not the case. If I don't specify a terminator (or higher up, a separator) then the parser just keeps consuming characters until it gets to some previously defined terminator or separator.

As far as I can tell, dfdl:calendarPattern is non-functional.

Thoughts?

/Roger



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130305/52cc215c/attachment-0001.html>


More information about the dfdl-wg mailing list