[xsd-users] Empty enumeration results in cxx value

Stephen James Stephen.James at genband.com
Tue Nov 17 09:26:34 EST 2009


I get and error when I try what is suggested.

../xsd-3.2.0-sparc-solaris/bin/xsd cxx-tree --cxx-suffix .cc
--hxx-suffix .h --enumerator-regex //empty_value/ acbtcap.xsd
error: invalid enumerator name regex: '': Empty expression

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Tuesday, November 17, 2009 6:44 AM
To: Stephen James
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Empty enumeration results in cxx value

Hi Stephen,

Stephen James <Stephen.James at genband.com> writes:

> <xs:simpleType name="busyfreestatusType">
>       <xs:restriction base="xs:string">
>         <xs:enumeration value=""/>
>         <xs:enumeration value="busy"/>
>         <xs:enumeration value="free"/>
>       </xs:restriction>
> </xs:simpleType>
> 
> My values end up being -
> 
>   enum value
>   {
>     cxx,
>     busy,
>     free
>   };
> 
> I understand that there is no name for "" but is the value cxx
controllable?

Yes, you can change enumerator names with the --enumerator-regex option.
For example, if add:

--enumerator-regex //empty_value/ 

when compiling the above schema fragment, I get:

enum value
{
  empty_value,
  busy,
  free
};

For more information on this option, see the NAMING CONVENTION section
in the XSD Compiler Command Line Manual:

http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml

Boris



More information about the xsd-users mailing list