users@jaxb.java.net

Re: Does not throw an validation exception

From: Sriram Thyagarajan <Sriram_Thyagarajan_at_KEANE-NNE.com>
Date: Fri, 09 May 2003 14:14:39 -0400

The setValidating is true...

by "it" I meant

Definition for CCYYMMDD is as follows...

  <xsd:simpleType name="StringDate_CCYYMMDD">
    <xsd:restriction base="xsd:string">
      <xsd:length value="8" fixed="true"/>
      <xsd:pattern
value="[1-2][0912][0-9][0-9]((((0[13578])|([13578])|(1[02]))(([1-9])|([0-2][
0-9])|(3[01])))|(((0[469])|([469])|(11))(([1-9])|([0-2][0-9])|(30)))|((2|02)
(([1-9])|([0-2][0-9]))))"/>
    </xsd:restriction>
  </xsd:simpleType>

does not flag the situation as error
   <AccidentDate></AccidentDate>

The definition does catch invalid dates if there is a non-empty value


Also, I am trying the following

  <xsd:simpleType name="StringNotNullDate_CCYYMMDD">
    <xsd:annotation>
     <xsd:appinfo>
        <jxb:javaType name="java.lang.String"
        parseMethod="XMLDataConvertor.parseNotNullStringtoDate_yyyyMMdd"
        printMethod="XMLDataConvertor.parseNotNullDateToString_yyyyMMdd" />
     </xsd:appinfo>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
    </xsd:restriction>
  </xsd:simpleType>

where my methods check if the dates are valid.... Also it just validates
and returns String (not date or calendar type)...

Which is better ?


-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Friday, May 09, 2003 2:04 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Does not throw an validation exception


> It does not catch the following situation...
>
> <AccidentDate></AccidentDate>

What do you refer to by "it"? The unmarshaller? Did you set the
setValidating(true)?

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com