Hi

ok, my customer hasn't absolutely perfect XSD and sends to me empty elements
even if their type is int.

I think primary problem is that utility class ConverterUtil and its methods
do not check input parameters for values null or empty string to avoid
useless exceptions like:

java.lang.RuntimeException: In valid string to parse
in convertToDate(String) method

or
java.lang.NumberFormatException
in convertToDecimal(String) method


Is there any reason why robustness of common utility class ConverterUtil
cannot be improved? In many cases if input parameter is null of empty string
the valid return value is null, I think.

-- 
Jozef Krssak


On 10/8/07, Amila Suriarachchi <[EMAIL PROTECTED]> wrote:
>
> you have to declare your element as nillable=true if you want to have
> xs:nil=true
>
> <xsd:element name="EndDate" type="tns:WSTypeDate" nillable="true"/>
>
> Amila.
>
> On 10/8/07, Jozef Krssak <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > Element definition in schema:
> >
> > <xsd:element name="EndDate" type="wsct:WSTypeDate" minOccurs="1"/>
> >
> > Type "wsct:WSTypeDate" is in other schema as:
> >
> >     <xsd:simpleType name="WSTypeDate">
> >         <xsd:restriction base="xsd:date">
> >             <xsd:pattern value='[0-9]{4}-[0-9]{2}-[0-9]{2}'/>
> >         </xsd:restriction>
> >     </xsd:simpleType>
> >
> >
> > Element in XML:
> >
> > <EndDate xsi:nil="true"/>
> >
> >
> > Another one example:
> > <xsd:element name="SMS_Provider" type="wsct:WSTypeChar3" minOccurs="1"/>
> >
> > <xsd:simpleType name="WSTypeChar3"><xsd:restriction
> > base="xsd:string"><xsd:maxLength
> > value="3"/></xsd:restriction></xsd:simpleType>
> >
> > <SMS_Provider xsi:nil="true"/>
> >
> >
> >
> > Thanks and Regards
> > --
> > Jozef Krssak
> >
> >
> > On 10/5/07, Amila Suriarachchi < [EMAIL PROTECTED]> wrote:
> > >
> > > Can you send a sample schema and sample xml you get as well?
> > >
> > > I guess you talk something like this.
> > >
> > > <xs:element name="test" type="xs:int"/>
> > >
> > > and you get an xml for this like this
> > >
> > > <test></test>
> > >
> > > My question is, is this a valid xml for this? if the type is int there
> > > must be an int inside it.
> > >
> > > on the other hand you can have
> > > <xs:element nillable="true" minOccurs="0"  name="test" type="xs:int"/>
> > >
> > >
> > > to represent that is null. but above is an invalid xml.
> > >
> > > Amila.
> > >
> >
> >
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.

Reply via email to