You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Steve Hathaway <sh...@e-z.net> on 2012/06/06 05:31:50 UTC

Re: Handling Parameters

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-DDThh: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


Re: Handling Parameters

Posted by Samuel Medeiros <cc...@gmail.com>.
Michael,

thanks for this information.
I will check if those functions are exposed. If they are, I think too that
is better reuse them.

Sincerely,
Samuel Queiroz

2012/6/7 Michael Glavassevich <mr...@ca.ibm.com>

> 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: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Samuel Medeiros <cc...@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 <sh...@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)
>



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

Re: Handling Parameters

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
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: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Samuel Medeiros <cc...@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 <sh...@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)

Re: Handling Parameters

Posted by Samuel Medeiros <cc...@gmail.com>.
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 <sh...@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)