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

J

Jean-Marie Condom

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
 
S

Sudsy

Jean-Marie Condom said:
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>
 
J

Jean-Marie Condom

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top