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 12:57:42 -0400

Ok I am moving to xs:string after fighting with it for a while -:)

But have a problem...

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>

The element defintion is as follows

      <xsd:element name="AccidentDate" type="StringDate_CCYYMMDD"
        minOccurs="1" maxOccurs="1"/>


It does not catch the following situation...

    <AccidentDate></AccidentDate>


How can I enforce this in the pattern ?

Is there any link or documentation available on the way to define/specify
patterns ?

Thanks

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


If I were you, I'd fix the schema so that you derive CCYYMMDD from
xs:token or xs:string with a pattern facet. That's the right way to go.

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