[xsd-users] --type-regex looses default regex
boris at codesynthesis.com
Tue Sep 9 03:31:55 EDT 2008
Jean-Pierre Bergamin <james at ractive.ch> writes:
> If I add the option "--type-regex /(.+)Type/$1/" (to get rid of the
> "Type" suffix in class names) to the command line of xsd, the generated
> class names contain the full namespace, i.e. class
> http___www_example_com_somewhat_SomeName. When having a look at the
> output with --name-regex-trace, the normally applied regex (?:[^ ]*
> )?([^,]+) is not applied any more. Shouldn't this be applied anyway? The
> documentation of type-regex says: "Add <regex> to the list of regular
> expressions", so I'm guessing that my given regex is evaluated after the
> default one.
The regular expressions are added to the list and evaluated until
one of them matches. Here is the relevant quote from the "NAMING
CONVENTION" section of the XSD Compiler Command Line Manual:
"All regular expressions for each category are pushed into a
category-specific stack with the last specified expression
considered first. The first match that succeeds is used."
So what happens in your case is that your expression is evaluated
before the built-in ones and since it matches, the result is used
without trying any other expressions. Therefore you will need to
also match the optional namespace part.
More information about the xsd-users