[xsd-users] splitting generated code into several files

Boris Kolpackov boris at codesynthesis.com
Mon Dec 5 06:41:40 EST 2005


Chang,

Chang Chen <chenchang19760717 at yahoo.com> writes:

> Ideally, I think we should not read the code which generated by xsd
> and only focus on the xsd, but the reality is not, we should read the
> code:
>
> 1)  When we begin to study this facility, we should read code for
>     understanding what xsd can do.

While you certainly can and are welcome to read the generated code, there
are easier ways to understand the mapping, for example by reading the
manual:

http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/


> 2)  When we debug the code, we should read the code.

I agree, you may end up in the generated code while debugging your
application.


> If xsd generates a huge source file, and many classes in it, we can
> not focus the class well which we should understand, and it is a
> heavy overhead for IDE (such as vs.net) to load it into memory.

I think those are valid points. However the task of splitting the
generated code into several source files is fairly complex (remember,
that types refer to each other which should result in proper
#include directives) and in some cases it is simply not possible
(e.g., when types inter-dependencies form a cyclic graph).

So for now your best bet is to split the schema manually using
XML Schema include/import facilities.


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20051205/a164c670/attachment.pgp


More information about the xsd-users mailing list