You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Jozef Krssak <jo...@gmail.com> on 2007/10/04 12:27:14 UTC

Re: Problem with pattern restriction in XSD and WDSL2Java generated code

Hi

On 9/28/07, Amila Suriarachchi <am...@gmail.com> wrote:
>
>
>
> On 9/28/07, Amila Suriarachchi <am...@gmail.com> wrote:
> >
> > hi,
> >
> > this should be a bug. we have to use the connvertToString method
> > of the ConverterUtil class. which properly out put the string values.
>
>
> please have a look at with a nightly build.
>
>
Sorry for late answer, I have tested it with today's nightly build.
Well, ConverterUtil.convertToString(Date) use own hard coded pattern to
convert to String and output of this method in my case is "2007-07-09Z" and
due to letter Z this output does not match my pattern
"[0-9]{4}-[0-9]{2}-[0-9]{2}". Of course problem with letter Z instead of
time zone can be fixed. Important is that pattern in convertToString() is
hard coded ("yyyy-MM-dd'Z'") while pattern in XSD can be variable,
e.g"[0-9]{2}-[0-9]{2}-[0-9]{4}".

I still think that to test if any value match any string pattern is usefull
when parameter of generated method is String (e.g. setWSTypeDate(String))
and not Date (e.g. setWSTypeDate(java.util.Date).
It is hard to solve it, because someone can want to use patter to allow set
only specific date (e.g. "[0-9]{2}-[0-9]{2}-1[0-9]{3}").

Thanks and Regards

-- 
Jozef Krssak

Re: Problem with pattern restriction in XSD and WDSL2Java generated code

Posted by Amila Suriarachchi <am...@gmail.com>.
On 10/4/07, Jozef Krssak <jo...@gmail.com> wrote:
>
> Hi
>
> On 9/28/07, Amila Suriarachchi <am...@gmail.com> wrote:
> >
> >
> >
> > On 9/28/07, Amila Suriarachchi < amilasuriarachchi@gmail.com> wrote:
> > >
> > > hi,
> > >
> > > this should be a bug. we have to use the connvertToString method
> > > of the ConverterUtil class. which properly out put the string values.
> >
> >
> > please have a look at with a nightly build.
> >
> >
> Sorry for late answer, I have tested it with today's nightly build.
> Well, ConverterUtil.convertToString(Date) use own hard coded pattern to
> convert to String and output of this method in my case is "2007-07-09Z" and
> due to letter Z this output does not match my pattern
> "[0-9]{4}-[0-9]{2}-[0-9]{2}". Of course problem with letter Z instead of
> time zone can be fixed. Important is that pattern in convertToString() is
> hard coded ("yyyy-MM-dd'Z'") while pattern in XSD can be variable, e.g"[0-9]{2}-[0-9]{2}-[0-9]{4}".
>
> I still think that to test if any value match any string pattern is
> usefull when parameter of generated method is String (e.g.
> setWSTypeDate(String)) and not Date ( e.g. setWSTypeDate(java.util.Date).
> It is hard to solve it, because someone can want to use patter to allow
> set only specific date (e.g. "[0-9]{2}-[0-9]{2}-1[0-9]{3}").


According to the xml spec[1] there is a specific pattern to specify the
date. And also I think Axis2 date serialization should change to use the
recovarable time zone. i.e real time zone.

if you giving a pattern to the date it is also better to put that pattern so
that any serialization format accept it.

Amila.

[1] http://www.w3.org/TR/xmlschema-2/#date

Thanks and Regards
>
> --
> Jozef Krssak
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.