[xsd-users] Restricted NMTOKENS (enumeration) with default value

Andre Vautour andre.vautour at caris.com
Fri Jan 9 08:04:23 EST 2015


Thanks Boris.

> I have a fix in the repository and can build you a pre-release binary if
> you would like. An easy workaround is to add the --generate-default-ctor
> option or change NMTOKENS to NMTOKEN (see below).
Generating the default constructors for that schema should be fine. I 
hadn't noticed that option.

Cheers,
André

On 2015-01-09 05:43, Boris Kolpackov wrote:
> Hi Andre,
>
> Andre Vautour <andre.vautour at caris.com> writes:
>
>> I ran into a problem with a schema that has an enumeration
>> (xsd:NMTOKENS with restrictions) that has a default value. The
>> generated enum does not seem to have a default constructor, yet the
>> generated default initialization method tries to use the default
>> constructor.
> I have a fix in the repository and can build you a pre-release binary if
> you would like. An easy workaround is to add the --generate-default-ctor
> option or change NMTOKENS to NMTOKEN (see below).
>
>
>>          <xsd:simpleType>
>>              <xsd:restriction base="xsd:NMTOKENS">
>>                  <xsd:enumeration value="red"/>
>>                  <xsd:enumeration value="green"/>
>>                  <xsd:enumeration value="blue"/>
>>              </xsd:restriction>
>>
>> [...]
>>
>> I ran into this particular problem when trying to generate OGC's OWS
>> 1.1.0 schema, see the rangeClosure attribute of RangeType:
>> http://schemas.opengis.net/ows/1.1.0/owsDomainType.xsd
> Using NMTOKENS for this enumeration doesn't make any sense. Why would
> you base a color type on a list of tokens? In fact I suspect what
> happened is this: someone was editing this schema in some visual
> editor and when selecting the attribute's type from the drop-down
> list, accidentally clicked on NMTOKENS instead of NMTOKEN (they would
> be right next to each other). The result doesn't make sense but is
> legal XML Schema (as are a lot of other bizarre cases), so nobody
> noticed.
>
> Boris

-- 
*André Vautour*, B.Sc.
Application Developer
CARIS <http://www.caris.com>
115 Waggoners Lane
Fredericton, New Brunswick
Canada    E3B 2L4
Tel: +1.506.458.8533     Fax: +1.506.459.3849
www.caris.com <http://www.caris.com>

*Connect with CARIS*
Twitter <http://www.twitter.com/CARIS_GIS> LinkedIn 
<http://www.linkedin.com/groups?mostPopular=&gid=3217878> FaceBook 
<http://www.facebook.com/pages/CARIS-The-Marine-GIS-Experts/123907500987669?v=app_4949752878> 
YouTube <http://www.youtube.com/user/CARISGIS>

Download your free copy of CARIS Easy View today!
www.caris.com/easyview <http://www.caris.com/easyview>

_________________________________________________________________________
This email and any files transmitted with it are confidential and 
intended only for the addressee(s). If you are not the intended 
recipient(s) please notify us by email reply. You should not use, 
disclose, distribute or copy this communication if received in error.

Any views or opinions expressed in this email are solely those of the 
author and do not necessarily represent those of the company. No binding 
contract will result from this email until such time as a written 
document is signed on behalf of the company.



More information about the xsd-users mailing list