Hi Samuel, Xerces-C would have code which validates the various XML Schema date/time types. Not sure if the functions are exposed, but you may want to consider using them if they are.
Thanks. Michael Glavassevich XML Technologies and WAS Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Samuel Medeiros <ccc.sam...@gmail.com> wrote on 07/06/2012 03:10:20 PM: > 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 (CCYY-MM-DDThh:mm:ss) > xs:date (CCYY-MM-DD) > xs:gYearMonth (CCYY-MM) > xs: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)