Steven,

I have implemented a compliance check of the parameters with accepted
standards through regex.
For example, to validate the date/time parameter, I am using the following
regular expression:
-?[0-9]{4}(-[0-9]{2}(-[0-9]{2}(T[0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{1,3})?)?)?)?(Z|([+-][0-9]{2}:[0-9]{2}))?

Now, I just have to throw an error message if the date/time input does not
match with this regex.
The same for duration.

Sincerely,
Samuel Queiroz


2012/6/6 Steve Hathaway <shath...@e-z.net>

>  Samuel,
>
> It is good practice to validate parameters and issue an appropriate error
> or exception.
> The function class that will be extended for XPath has the ability to
> transmit
> error messages back to the stylesheet transformation application.
>
> Users and applications are known to put bad formatted data into strings.
> We should be able to recognize and report the errors in a standard way.
>
> There are already lots of standard messages in the library.  If one is
> appropriate,
> it can be used.  Otherwise we can create new message strings and add them
> to the
> library.
>
> I will do some brief research and get back to you.
>
> Sincerely,
> Steven J. Hathaway
>
>
> On 6/5/2012 9:15 AM, Samuel Medeiros wrote:
>
> Steven,
>
>  I am finishing to implement the add function described at
> http://www.exslt.org/date/functions/add/index.html.
> It receives two strings: the date and the duration.
> The date may be in the following formats:
>
>    - xs:dateTime <http://www.w3.org/TR/xmlschema-2/#dateTime> (CCYY-MM-DDT
>    hh:mm:ss)
>    - xs:date <http://www.w3.org/TR/xmlschema-2/#date> (CCYY-MM-DD)
>    - xs:gYearMonth <http://www.w3.org/TR/xmlschema-2/#gYearMonth> (CCYY-MM
>    )
>    - xs:gYear <http://www.w3.org/TR/xmlschema-2/#gYear> (CCYY)
>
> Do I need to verify or should I assume that they are in one of the
> accepted formats?
> For date parameter, for example, I would verify if the YY, MM and DD are
> integers, MM is >0 e <= 12 and the day is valid in the pair YY-MM.
>
>  Sincerely,
> Samuel Queiroz
>
>
>


-- 
Samuel de Medeiros Queiroz
Formal Methods Group (GMF - UFCG - Brazil)

Reply via email to