
List Type
An xsd:list type is used to model a space-separated list of values of a given type. This type is mapped to a linked-list type. The built-in OSRTDList type (run-time doubly linked list) is the type used for repeating sequences such as this. This list type can be used with the rtxDList run-time functions for building and manipulating lists. See the section on linked list run-time functions for more details.
In the case of C++, the built-in OSRTDListClass type is extended. This class extends the C OSRTDList structure and adds constructors and methods for adding, finding, and removing items from the list. The generated C++ code contains versions of these methods that correspond to the specific type of the element within the list.
The general C and C++ mapping for an XSD list type is as follows:
<xsd:simpleType name="TypeName"> <xsd:list itemType="Type"/> </xsd:simpleType> typedef OSRTDList TypeName; class TypeName : public OSRTDListClass { ... } ;
The one exception to this mapping occurs when the referenced item type is an enumeration. In this case, a structure is generated with each enumerated item represented as a single bit. This is a more compact structure that is easier to work with for specifying enumerated items and for validation to make sure there are no duplicates in the list. The mapping for this special case is as follows:
Each of the bit fields in this type represents a declared enumeration item in the XSD definition. The _extItems field is added for extensibility purposes (i.e. if an unknown item is received it is added to this list). This construct will be used if a declared enumerated type is referenced (as is the case above) or if the list type contains an anonymous type with an enumeration list.
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, 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 |