[xsd-users] different behavior by xsd 3.0 and 3.2
Boris Kolpackov
boris at codesynthesis.com
Mon Oct 6 12:58:51 EDT 2008
Hi Jeffrey,
Jeffrey Yu <jeffrey.yu at panpacificinvestment.com> writes:
> Do you think it is possible to deploy a better name mangling mechanism
> in xsd compiler so variable names can be unique and don't collide
> With the user-defined variables?
This is a hard problem. If the translation (XML Schema to C++ in our
case) adds any names then there is always a chance they will conflict
with the ones in the source. So the only true solution to this problem
is not to add any names which is not really an option in our case. There
are further complication with, for example, C++ not allowing a member
function to have the same name as the class. In XML Schema you can have
a type and an element/attribute inside this type with the same name.
> In short, it is the preprocessors placed in top of the .hxx have the
> different names caused the problem.
You can override the include guard prefix with the --guard-prefix
option, for example:
$ xsd cxx-tree foo/bar.xsd
In this case the guard will be FOO_BAR_HXX. If we add the option:
$ xsd cxx-tree --guard-prefix p foo/bar.xsd
the guard will be P_BAR_HXX regardless of the path to the schema.
Boris
More information about the xsd-users
mailing list