Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JAXB : expecting an automatical control in java source when restrictions are specified in XML schema

Reply
Thread Tools

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

 
 
Jean-Marie Condom
Guest
Posts: n/a
 
      11-24-2004
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
 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      11-24-2004
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.

 
Reply With Quote
 
 
 
 
Jean-Marie Condom
Guest
Posts: n/a
 
      11-26-2004
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>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Restrictions in XML Schema Paul Johnston XML 1 11-20-2006 07:38 PM
XML Schema: How to put restrictions on element names ruediger XML 0 05-06-2006 08:51 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
Can JAXB be used to get a Java representation of an XML Schema? SOndei Java 0 01-15-2004 09:20 AM



Advertisments