[xsd-users] How to create custom accessors/setters/getters

Boris Kolpackov boris at codesynthesis.com
Wed Dec 5 06:16:21 EST 2007


Hi Amnon,

Janiv, Amnon <amnon.janiv at lehman.com> writes:

> What is the best way to have custom set and get functions for attributes
> generated by xsd?  This is required for backward compatibility, and I
> would to have the accessors generated automatically.
>
> Instead of:
> virtual void
> greeting (const ::std::string&);
>
> I would like:
> setGreeting (const ::std::string&);

There is a new feature that is implemented for the next release of
XSD that allows you to choose type/function naming conventions. In
your case all you will need to do is add the '--function-naming java'
option to the XSD command line.

There is a pre-release binary with this feature available for
GNU/Linux:

http://codesynthesis.com/~boris/tmp/xsd-3.1.0.a3-i686-linux-gnu.tar.bz2

If you need a binary for a different OS, please let me know. For more
information on the new naming convention options, see the NAMING
CONVENTION section in the XSD Compiler Command Line Manual which can
be found in the documentation/ directory in the above distribution as
either xsd.xhtml (HTML) or xsd.1 (man pages).

Boris




More information about the xsd-users mailing list