TOC PREV NEXT INDEX


Attribute Extension


It is possible to extend a base type to contain additional attributes. In this case, the additional attribute definitions are added to the structure generated for the complexContent type.
The general mapping for complexContent with extension attributes is as follows:
XSD type:
<xsd:complexType name="TypeName">
 
   <xsd:complexContent>
 
      <xsd:extension base="BaseType">
 
         <xsd:attribute name="attr1" type="Type1"/>
 
         <xsd:attribute name="attr2" type="Type2"/>
 
         ...
 
         <xsd:attribute name="attrN" type="TypeN"/>
 
      </xsd:extension>
 
   </xsd:complexContent>
 
</xsd:complexType>
 

 
Generated C code:
typedef struct TypeName {
 
   BaseType		base;
 

 
   /* attributes */
 
   Type1 attr1;
 
   Type2 attr2;
 
   ...
 
   TypeN attrN;
 
} TypeName;
 
 
Generated C++ code:
class TypeName : public BaseType {
 
   /* attributes */
 
   Type1 attr1;
 
   Type2 attr2;
 
   ...
 
   TypeN attrN;
 

 
   ...
 
} ;
 
 


In this case, the attributes are handled the same as they were in the Attributes section above. If any are optional, an optional bit mask is added at the beginning of the complexContent structure. Logic to handle fixed and default values is added to the initialization and encode/decode functions.

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