Sam, this isn't a problem with JAXB--your schema is not valid. A value of
type xs:NCName must start with a letter or underscore, although it may
contains digits, '-' and '.' after the first character.
http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName
So you either need to change your values to obey this restriction, or change
the base type to something other than xs:NCName (xs:token should be OK).
For a full explanation of XML schema datatypes go here:
http://www.w3.org/TR/xmlschema-2/
Best regards,
Robert Lowe
http://RMLowe.com/
-----Original Message-----
From: Sam Cheung [mailto:sylcheung_at_hotmail.com]
Sent: Sunday, February 15, 2004 2:01 PM
To: users_at_jaxb.dev.java.net
Subject: Integer in Enumeration value
Hi,
I have this emumeration in my schema, but I got an
enumeration-valid-restriction error when I try to run xjc to generate Java
code:
<xs:simpleType name="versionType">
<xs:restriction base="xs:NCName">
<xs:enumeration value="5.0.1" />
<xs:enumeration value="5.0.2" />
<xs:enumeration value="5.0.3" />
</xs:restriction>
</xs:simpleType>
I got this error when I run xjc to generate code:
[xjc] [ERROR] enumeration-valid-restriction: enumeration value '5.0.1' is
not in the value space of {base type definition}.
[xjc] line 394 of REL-5-MM7-1-3.xsd.out
I try adding this annotation in the element, but that does not help.
<xs:appinfo>
<jxb:avaType name="string"/>
</xs:appinfo>
I also try adding this in the binding file, but that does not help also.
<jxb:globalBindings
typesafeEnumBase="xs:NCName"
/>
But when I change the value of the enumeration value to "a.b.c", everything
works fine.
So I think it is the integer in the value causes the problem.
Does anyone know how to resolve this problem?
Any help is appreciated.
Thank you.
Sam
_________________________________________________________________
Create your own personal Web page with the info you use most, at My MSN.
http://click.atdmt.com/AVE/go/onm00200364ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net