[xsd-users] suggestion
Boris Kolpackov
boris at codesynthesis.com
Thu Jul 17 09:47:25 EDT 2008
Hi Ray,
Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:
> I'd like to make a minor suggestion. Could the xsd compiler put the
> command line used to generate the output files into those output files
> as a comment?
It would be impossible to put the exact command line into the generated
code because of shell expansions. Here is an example that shows what I
mean:
$ xsd cxx-tree --accessor-regex "/(.+)/get_$$1/" test.xsd
The XSD compiler sees it as the following elements in a string array:
cxx-tree
--accessor-regex
/(.+)/get_$1/
test.xsd
As you can see "'s and $$ are gone. If someone tries to use a command
line based on these values, they will get an error.
But I think there is a much better approach that is available right now.
You can put all your options in an options file (where not shell quoting
or escaping is necessary), one options per line, for example:
# test.options
#
--accessor-regex /(.+)/get_$1/
Then you can add options to this file to include itself as a comment
in the generated code:
# test.options
#
--accessor-regex /(.+)/get_$1/
# The following options include this options file into generated
# files.
#
--prologue /*
--prologue This file was generated with the following options file:
--prologue-file test.options
# end test.options
# */
Then, when compiling your schema you run the compiler like this:
$ xsd cxx-tree --options-file test.options test.xsd
You can also include this command line in the comment if you like.
Boris
More information about the xsd-users
mailing list