[xsd-users] "must-be-one-of' choices in xsd

Boris Kolpackov boris at codesynthesis.com
Tue Apr 29 09:59:44 EDT 2014


Hi Rob,

Rob Ursem <Rob.Ursem at cmgl.ca> writes:

> Both sides of the choice are optional and the show that either is
> required. In fact, if you don't sp elements, the object writes
> without any notification, resultin invalid XML being generated.

The C++/Tree mapping flattens the compositor structure. There is
also no enforcement of schema constraints in the interface or at
runtime (for many cases such an enforcement will quickly make the
object model very hard to use).


> I could derive a subclass for every class [...]

Yes, type customization can be used to add custom validation checks.

Alternatively, you may want to check C++/Hybrid in XSD/e. This mapping
recreates the compositor structure so, for example, you would not be
able to specify both elements. The missing element would be detected
during serialization, if validation is enabled.

[1] http://www.codesynthesis.com/products/xsde/

Boris



More information about the xsd-users mailing list