[xsd-users] Customizing generated code: Renaming classes, fields and functions.

Boris Kolpackov boris at codesynthesis.com
Tue Nov 24 05:58:10 EST 2009


Hi Vladimir,

Vladimir Vasilyev <vladimir.vasilyev at mobile-mir.com> writes:

> 1. How can I rename the getters and setters using prefixes, suffixes
> and/or other standard operations?
> For a field "name" I want to have a getter "GetName" and setters
> "SetName", and not "const string& name" and "void name".

See Section "NAMING CONVENTION" in the XSD Compiler Command Line Manual:

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

You could have used the 'java' function naming convention except that
the name would start with a lower case letter instead of the upper
case as you need. So you will probably need to provide your own
regular expressions.


> 2. How can I rename the getter using my own algorithm?

You can provide your own regular expressions to transform the function
names. See the above mentioned documentation for details.


> 3. How can I rename the member fields from "name_" to "m_name"?
> Our coding style is different and should not be modified...

You currently cannot do this except by customizing the compiler. Note,
however, that these variables are private so the hand-written code will 
never reference such names directly.


> 4. How can I rename classes using my own algorithm?

You can provide your own regular expressions to transform the type
names. See the above mentioned documentation for details.


Boris



More information about the xsd-users mailing list