TOC PREV NEXT INDEX


ComplexContent


The XSD ComplexContent type <xsd:complexContent> is used to create a modified version of a base type through extension or restriction mechanisms. It is similar in concept to creating derived types in Java or C++. ComplexContent is handled differently depending on whether C or C++ code is being generated. For C, the type is converted into a C structured type containing a base element (_base) and, optionally, an extensions element (_ext) and additional attribute elements. The extension element will only appear if the extension mechanism is used to add additional elements to an existing content model group (sequence, all, or choice).
In addition to the standard type that is generated to hold the type's content, a special derivations type is also generated. This is generated in a separate file called <project>Derivations.h. This type is based on the base type of the derivation (i.e. the complexContent base element) and contains a union of all of the possible types that are derived from a given base. A reference to this type is used in all place where the base type is referenced. This makes it possible to handle type susstituition through the XML schema instance type attribute (xsi:type).
For C++, the inheritance mechanism is used with the generated derivations classes to make type substitution possible. All content items (elements and attributes) for a given complexContent type will be aggregated in the generated class and then the derivations class will be used as the base class. The derivations class is fully abstract - it contains no data items. It's purpose is to act as an interface specification does in Java, it provides only a placeholder for the use of any of the concrete classes that can be used in the type.

Copyright © Objective Systems 2002-2008
This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included.

Objective Systems, Inc.

55 Dowlin Forge Road
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com

TOC PREV NEXT INDEX