[xsde-users] enumeration type support

Boris Kolpackov boris at codesynthesis.com
Mon Aug 10 03:58:16 EDT 2009


Hi Thomas,

Thomas Frenzel (TomSun) <tftomsun at streamteam.de> writes:

> There's one thing that i am missing. Why do i have to implement the 
> enum parse/serialization by myself? I would like to get an generated
> enum for each simple type that derives from string and contains only
> enumerations. Additionally i would like to have generated 
> serializer/parser classes that does the validation for me

I agree, handling of enums in C++/Parser and C++/Serializer is
somewhat awkward. The problem with the approach you suggested is
that conceptually these two mappings don't generate object model
types. They only provide parser and serializer skeletons. The
object model types are provided, if any, by the application
developer.

Maybe we could generate a helper enum class inside the generated
parser skeleton along with the corresponding callback function.
Something like this:

class gender_pskel
{
  enum gender
  {
    male,
    female
  };

  virtual void pre ();
  virtual void value (gender g);
  virtual void post_gender ();
};

In any case, I have added this to my TODO list and will try to come 
up with a solution for the next release of XSD/e. Thanks for the
suggestion!

Boris



More information about the xsde-users mailing list