Extensions

The only purpose of simple content extensions is to add attributes to an existing base type. The base type must either be a complex type with simpleContent, or a simple type. In the following example, let SimpleBaseType be the representation for the simple type that is the content model for TypeName.

The general mapping is as follows:

XSD type:

   <xsd:complexType name="TypeName">
      <xsd:simpleContent>
         <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:simpleContent>
   </xsd:complexType>

Generated C code:

   typedef struct TypeName {
      SimpleBaseType _base;

      /* attributes */
      Type1 attr1;
      Type2 attr2;
      ...
      TypeN attrN;
   } TypeName;

Generated C++ code:

   class TypeName : public OSXSDComplexType {
      // The simpleType extended by simpleContent
      SimpleBaseType value;

      /* attributes */
      Type1 attr1;
      Type2 attr2;
      ...
      TypeN attrN;

      ...
   } ;