[xsd-users] Groups and AttributeGroups

Boris Kolpackov boris at codesynthesis.com
Mon Mar 12 15:31:11 EDT 2007


Hi Mark,

Mark Watson <mark at digitalfountain.com> writes:

> Returning to this question. I have the templates approach working. However,
> I have some 20-30 attributes/elements defined in 7 or 8 groups which then
> appear in various combinations in 10 or so different types and the result is
> hundreds and hundreds of lines of generated code. The templates approach
> works, but it feels a little unmanageable at this scale.

What exactly are you concerned here with? Is it the object code size
that results from the generated code? Is it the object code size
that results from the function templates? Note that, in this case,
it does not make much sense to count the lines of generated code
because all the generated accessors/modifiers (pretty much what
constitutes a group in the generate code) are inline one-liners.


> What's the chance that some mechanism to factor out groups into common
> base classes might make it into some future xsd release ?

I am not convinced it is a good idea. The only benefit I see is
the ability to handle group generically without using things
like templates. There are a number of serious disadvantages
though, including significant complications in the generated
code logic and increased object code size.

To be specific, right now each element/attribute in a type
results in the following three major parts in the generated
code:

 (1) Inline accessors/modifiers.

 (2) A small piece of code in the c-tor.

 (3) A small piece of code in the parsing function.

These are generated in every class that references a group. With
the base class approach we will need exactly the same code in the
common base class plus the following in each class that references
the group:

 (1) A small piece of code that forwards arguments to the base c-tor.

 (2) A significantly more complicated parsing code that figures
     our when and what to delegate to the group classes.


I think (1) here and (2) above will be about the same. I expect
(2) to result in more code than (3) above. Plus you get all the
extra (2) and (3) above for each group class.


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/20070312/2fce4644/attachment.pgp


More information about the xsd-users mailing list