[xsde-users] variable length member : suggestion for "_present (bool x)" methods

Boris Kolpackov boris at codesynthesis.com
Mon Sep 13 11:49:45 EDT 2010

Hi Ivan,

Ivan Le Lann <ivan.lelann at free.fr> writes:

> I hope I do not bother you with all my comments!

Not at all. I always appreciate feedback based on actual usage.

> "_present (bool)" could be switch to void/error, but that's quite ugly.


> It is to be able to write the same code for fix/var elements,
> as much as possible.

I don't think this is an achievable goal in all configurations. And
I don't think it makes sense to "fix" some cases and give up on the
rest. It should be all or nothing. Otherwise you always have to stop
and think whether this particular case is handled automatically or
requires manual intervention.

> >Maybe not generate _present(bool) for var-length members at all?
> You don't end with var/fix independant code, but at least,
> this is compile time error. I consider it a better way.
> This is the exact opposite of what I suggested, though! :-D

The advantage of this approach is that it will point the location
of where things need to be changed. Compare this: hoping that you
didn't miss any cases where the XSD/e compiler can't handle fix/var
differences vs knowing that the C++ compiler will always flag such
cases. I will take the latter any day.


More information about the xsde-users mailing list