[xsd-users] Custom get/set methods

Boris Kolpackov boris at codesynthesis.com
Fri Nov 16 07:34:51 EST 2007


Hi Jeroen,

Jeroen N. Witmond [Bahco] <jnw at xs4all.nl> writes:

> This is merely a thougth, but why not store all needed transformations in
> a configuration file in XML? So xsd at least should not have any trouble
> parsing it. :)

Yes, and then we will need XSD to build XSD ;-)


> More specifically, a configuration file could contain one regex for
> setters, one for getters, and one for whatever you like.
>
> For instance:
>
> <transformations>
>
>     <transform function="getter" regex="/$([^ ])+/get\1/"/>
>
> </transformations>
>
> On second thought, you may even want to store equivalent of any command
> line option in a configuration file.

I think an XML-based format would be an overkill since there is not
much structure. Something like this should be enough:

--get-name-regex /$([^ ])+/get\u$1/
--set-name-regex /$([^ ])+/set\u$1/
--type-name-regex /$([^ ])+/\u$1/

The idea of allowing a set of options supplied in a file is a good
one and I've been thinking about it for a while now. Something along
these lines:

--options-file <file>

With the semantics being equivalent to specifying all the options
from <file> in place of the --options-file option.

Boris




More information about the xsd-users mailing list