JAXB : expecting an automatical control in java source when restrictions are specified in XML schema

Discussion in 'Java' started by Jean-Marie Condom, Nov 24, 2004.

  1. hello

    when I specify a restriction in a xml schema such as the following
    simple type ZeroOrOne accepting only integer with value 0 or 1 :

    <xsd:simpleType name="ZeroOrOne">
    <xsd:restriction base="xsd:int">
    <xsd:minInclusive value="0"/>
    <xsd:maxExclusive value="2"/>
    </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="Connexion">
    <xsd:attribute name="reconnexion">
    </xsd:attribute>
    </xsd:complexType>

    I expect that the java source generated by xjc includes a control
    on the value of attribute "reconnexion" when reading the
    corresponding xml file

    but no control is coded and "reconnexion" may
    be set to any value, the xml file is read
    without generating any error if "reconnexion" is
    not equal to 0 or 1

    surely i misunderstood sth in using JAXB

    can someone help me

    thanks in advance

    Jean-Marie
     
    Jean-Marie Condom, Nov 24, 2004
    #1
    1. Advertising

  2. Jean-Marie Condom

    Sudsy Guest

    Re: JAXB : expecting an automatical control in java source when restrictionsare specified in XML schema

    Jean-Marie Condom wrote:
    > hello
    >
    > when I specify a restriction in a xml schema such as the following
    > simple type ZeroOrOne accepting only integer with value 0 or 1 :
    >
    > <xsd:simpleType name="ZeroOrOne">
    > <xsd:restriction base="xsd:int">
    > <xsd:minInclusive value="0"/>
    > <xsd:maxExclusive value="2"/>
    > </xsd:restriction>
    > </xsd:simpleType>
    >
    > <xsd:complexType name="Connexion">
    > <xsd:attribute name="reconnexion">
    > </xsd:attribute>
    > </xsd:complexType>


    Perhaps:

    <xsd:complexType name="Connexion">
    <xsd:attribute name="reconnexion" type="ZeroOrOne" />
    </xsd:complexType>

    --
    Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.
     
    Sudsy, Nov 24, 2004
    #2
    1. Advertising

  3. yes i had forgotten to write this in my email ;
    the pb was coming from the fact that i wasn't
    using Ant so the grammar wasn't used since
    file bgm.ser was absent
    now all is ok !

    jean-marie

    > Perhaps:
    >
    > <xsd:complexType name="Connexion">
    > <xsd:attribute name="reconnexion" type="ZeroOrOne" />
    > </xsd:complexType>
     
    Jean-Marie Condom, Nov 26, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SOndei
    Replies:
    0
    Views:
    419
    SOndei
    Jan 15, 2004
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,312
    Stanimir Stamenkov
    Apr 25, 2005
  3. ruediger
    Replies:
    0
    Views:
    589
    ruediger
    May 6, 2006
  4. Paul Johnston

    Restrictions in XML Schema

    Paul Johnston, Nov 8, 2006, in forum: XML
    Replies:
    1
    Views:
    472
  5. sqlsurfing
    Replies:
    0
    Views:
    894
    sqlsurfing
    Jan 27, 2010
Loading...

Share This Page