[xsd-users] How to export class with given namespace by CodeSynthesis XSD?

Boris Kolpackov boris at codesynthesis.com
Mon Aug 29 13:08:29 EDT 2011


Hi,

lEdUnkAnG <ledunkang at 163.com> writes:

> To avoid name-duplicating problem, I've to add namespace manually to
> generated C++ classes in file1.cxx/hxx and file2.cxx/hxx files. And it
> works.
> 
> What I'm wondering is that whether there is any convenient method to put 
> generated C++ class in given namespace by XSD command line options.

Yes, there is. It is called --namespace-map. In your case you would
use it like this:

... --namespace-map =ns1 file1.xsd
... --namespace-map =ns2 file2.xsd

The empty XML Schema namespace before the equal sign is used to indicate
that we are dealing with a schema without a target namespace (just like 
yours).

Boris



More information about the xsd-users mailing list