[xsd-users] Problem using --hxx-regex and --cxx-regex options

Jeroen N. Witmond jnw at xs4all.nl
Sun Feb 18 02:52:47 EST 2018


On 2018-02-16 14:16, Michele de Rosa wrote:

> I'm trying to modify the output filenames (headers and sources) 
> produced by
> xsd cxx parser by default, but I didn't understand how to use the
> --hxx-regex and --cxx-regex options. Where can I find examples of 
> usage?

I also could not find anything, so I experimented a bit, with the 
following results:

1, You do well to put the --*-regex options in an --options-file to keep 
the shell and the make utility from clobbering it.

2. The --*-regex option in the -options-file must start with --.

3. When you make a mistake and the result of the regexp is the name of 
the input .xsd file, this file is quietly overwritten.

4. The option --hxx-regex-trace is unknown.

5. The following options.file

>>> 
--hxx-regex %([^.]*)[.](.*)%$1.hpp%
<<<

will change the extension of the created header file to .hpp. This 
example regex is stupid in the sense that everything following the first 
dot in the name is regarded as the extension.

6. You use this options.file with a command line like:

>>> 
xsdcxx cxx-tree --options-file options.file test-000.xsd
<<<

7. When the file name on the command line starts with a directory name, 
for instance subdir/test-000.xsd, this directory name will not the 
passed to the regex, only the filename is. You can add a directory in 
the replacement part of the regex, for instance if you want the source 
file to be created in a directory different from the header file.

I have not experimented with the --cxx-regex option, but I assume 
identical behavior. Neither have I experimented with multiple 
--hxx-regexp options.

HTH,

Jeroen.



More information about the xsd-users mailing list