[xsd-users] Capturing schema version number
Boris Kolpackov
boris at codesynthesis.com
Thu Feb 17 09:26:24 EST 2011
Hi Ray,
Ray Lischner <rlischner at proteuseng.com> writes:
> We need to be able to record the schema version number in the generated
> code when the schema provides the version attribute. What I'd like to do
> is to declare an extern std::string or char array in the generated header,
> with the definition in the generated source file. I can easily write a
> script to get the schema version, but the --prologue and --epilogue
> switches insert their text outside the generated namespace. This is
> usually what I want, but in this case, I want to inject text inside
> the namespace. How do I do that?
I assume you realize that if you have two such schema files that map to
the same C++ namespace, you will get duplicate symbols down the line.
If you still want this, what prevents you from opening the namespace
in prologue/epilogue? If you don't want to hard-code C++ namespaces
in the command line, your script can extract the targetNamespace
attribute just as it does for version. You can then map it to a C++
namespace similar to how XSD does it.
Boris
More information about the xsd-users
mailing list