users@jaxb.java.net

Re: JXCFacade omit to build some types

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Mon, 14 Jun 2010 07:36:27 +0200

Your type datetimeformat isn't converted to enum because all
restrictions are (useless) duplicates. This compiles to an enum:

<xsd:simpleType name="datetimeformat">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="yyyy-MM-dd HH:mm:ss.SSS" />
<xsd:enumeration value="yyyy-MM-dd HH:mm:ss" />
<xsd:enumeration value="yyyy-MM-dd HH:mm" />
<xsd:enumeration value="yyyy-MM-dd HH" />
</xsd:restriction>
</xsd:simpleType>

@Pavel: It seems desirable to have a warning in such a case since it might be
difficult to spot this in other cases. Care to have an issue for enhancement?

-W

On 13 June 2010 18:33, Ugo Gagliardelli <ugo.gagliardelli_at_gmail.com> wrote:
> Thank you for the soon reply.
> Your first statement exacty describe my problem.
> In my posted example, simple types "dateformat", "timeformat" and
> "datetimeformat" have just <xs:enumeration> facet, but only the first two
> are correctly translated in corresponding enums class files, not the 3rd
> one, even if I leave it alone in an xsd file. This is confusing me al lot.
>
> Il 13/06/2010 18.22, Wolfgang Laun ha scritto:
>>
>> Any simple type derived from xs:string with a set of<xs:enumeration>
>>  facets
>> results in an enum class, which (obviuosly) must result in a Java class of
>> its
>> own.
>>
>> A simple type derived from xs:string with length, minLength, maxLength
>> or pattern facets remains at java.lang.String, because there is no Java
>> way of expressing such string subsets, and java.lang.String is a final
>> type.
>>
>> Notice that any checks against the facets are done when you unmarshal
>> or marshal with an (un)marshaller that has been given an XML schema
>> file.
>>
>> -W
>>
>>
>> On 13 June 2010 18:06, Ugo Gagliardelli<ugo.gagliardelli_at_gmail.com>
>>  wrote:
>>>
>>> I have and xsd file that contains some simpleTypes, when I run JXCFacade
>>> it
>>> generate correcty Dateformat and TimeFormat classes, while simply ignore
>>> numformat, intformat and datetimeformat, any other type generated class
>>> refer to these simpleTypes as String.
>>> Is there somewhat I miss? What's wrong?
>>> I tried to put the failing types in a xsd file alone too, running
>>> JXCFacade
>>> against this new xsd it just generete nothing: no episode.xml, no
>>> ObjectFactory no source file at all.
>>> I tried to change the base restriction to specific xs types as
>>> xs:dateTime
>>> with pattern facet but the generated java source just ignore patterns and
>>> associated properties will be GregorianCalendar without any dateformat
>>> restriction, so t's not a choice as well.
>>>
>>> <xs:simpleType name="numformat">
>>> <xs:restriction base="xs:string">
>>> <xs:maxLength value="50" />
>>> <xs:whiteSpace value="replace" />
>>> <xs:pattern value="[0]?[#]{1,15}[.]{1}[#]{0,6}"/>
>>> </xs:restriction>
>>> </xs:simpleType>
>>> <xs:simpleType name="intformat">
>>> <xs:restriction base="xs:string">
>>> <xs:maxLength value="50" />
>>> <xs:whiteSpace value="replace" />
>>> <xs:pattern value="[0]?[#]{1,15}"/>
>>> </xs:restriction>
>>> </xs:simpleType>
>>> <xs:simpleType name="dateformat">
>>> <xs:restriction base="xs:string">
>>> <xs:enumeration value="yyyy-MM-dd" />
>>> <xs:enumeration value="MM/dd/yyyy" />
>>> <xs:enumeration value="dd.MM.yyyy" />
>>> <xs:enumeration value="yyyy-MM-dd" />
>>> <xs:enumeration value="yyyy" />
>>> <xs:enumeration value="yyyyMM" />
>>> <xs:enumeration value="yyyyMMdd" />
>>> </xs:restriction>
>>> </xs:simpleType>
>>> <xs:simpleType name="timeformat">
>>> <xs:restriction base="xs:string">
>>> <xs:enumeration value="HH:mm:ss.SSS" />
>>> <xs:enumeration value="HH:mm:ss.SS" />
>>> <xs:enumeration value="HH:mm:ss.S" />
>>> <xs:enumeration value="HH:mm:ss" />
>>> <xs:enumeration value="HH:mm" />
>>> <xs:enumeration value="HH" />
>>> </xs:restriction>
>>> </xs:simpleType>
>>> <xs:simpleType name="datetimeformat">
>>> <xs:restriction base="xs:string">
>>> <xs:enumeration value="yyyy-MM-dd HH:mm:ss.SSS" />
>>> <xs:enumeration value="yyyy-MM-dd.HH.mm.ss.SSS" />
>>> <xs:enumeration value="yyyy-MM-dd HH:mm:ss" />
>>> <xs:enumeration value="yyyy-MM-dd.HH.mm.ss" />
>>> <xs:enumeration value="yyyy-MM-dd HH:mm" />
>>> <xs:enumeration value="yyyy-MM-dd.HH.mm" />
>>> <xs:enumeration value="yyyy-MM-dd HH" />
>>> <xs:enumeration value="yyyy-MM-dd.HH" />
>>> </xs:restriction>
>>> </xs:simpleType>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>