[xsd-users] Generate C++ header to be used on unix machine

Boris Kolpackov boris at codesynthesis.com
Wed Aug 5 05:45:13 EDT 2009


Hi Shaohua,

Liu, Shaohua <shaohua.liu at siemens.com> writes:

> I used the CodeSynthesis xsd tool to generate a C++ header file from 
> a xsd file with this command:
>
> "xsd mySchema.xsd /classes /l:CPP"

I am afraid you are invoking Microsoft's .Net XSD.exe tool instead of
CodeSynthesis XSD. The two products have the same executable name. If
you don't need to use the Microsoft's version, you can put the path to
the bin\ directory inside the CodeSynthesis XSD installation directory
at the beginning of your PATH environment variable. This will make
CodeSynthesis xsd.exe the default command invoked when you type xsd.

Alternatively, you can use the full path when running the compiler,
for example:

C:\Program Files\CodeSynthesis XSD 3.2\bin\xsd.exe

For more information on how to setup and use CodeSynthesis XSD on
Windows, see this document:

http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio

In particular, refer to the "Conflict with Microsoft xsd.exe"
section at the end.


> But I will have to use the header file on a Unix machine, so any 
> .NET reference will not work. I found that this xsd tool can be 
> built on Unix machine. So I think it should be able to create 
> C++ header files without .NET references. 

Yes, that's correct. CodeSynthesis XSD-generated C++ code does
not depend on .Net.


> I just wonder how I can do that on my Windows dev machine. Is 
> there any options that I can use to indicate that the output 
> should be unmanaged C++ or for unix?

If you run the correct executable as mentioned above, by default
you will get unmanaged C++ that is portable to UNIX platforms. I
suggest that you try something like this:

xsd cxx-tree MySchema.xsd

Or:

C:\Program Files\CodeSynthesis XSD 3.2\bin\xsd.exe cxx-tree MySchema.xsd

Boris




More information about the xsd-users mailing list