XML Binding Development Guide : PART III Advanced Topics : Chapter 7 Advanced Tasks : Working with Unsupported Complex Types
Working with Unsupported Complex Types
If your applications use complex types unsupported by HydraExpress, you can map them to a supported complex type using the HydraExpress project file. An example of an unsupported type might be a complex type that derives by restriction, and results in changing the types it holds.
When HydraExpress encounters an unsupported type during code generation, it will generally issue a warning, such as “WARNING: Mixed content type not supported.” If your generated code does not compile, see the readme file in your <installdir> directory for a list of unsupported schema features.
You have two options for mapping your unsupported complex types. You can map them to the XML Schema type anyType or to some other complex type of your own design.
For instance, you may have an existing unsupported type in your application that cannot be changed, but could be mapped to an equivalent, supported complex type. In this case, you would include the schema definition for the new complex type in your code generation directory before generating code, and map to it in the HydraExpress project file.
Alternatively, your unsupported type may have no reasonable equivalent type. In this case, you may map it to anyType.
For example, the following element MyComplexType contains one attribute and a nested complex type UnsupportedType, unsupported by HydraExpress:
 
<xs:element name="MyComplexType">
<xs:complexType>
<xs:attribute name="location" type="string"/>
<xs:sequence>
<xs:element ref="ns:UnsupportedType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
You can map this type to anyType using the <mappings> element in the HydraExpress project file:
 
<rwsf-codegen-project>
<options>
<option name='project-name' value='UnsupportedTypeMapping'/>
<mappings>
<schematype
xsdname="UnsupportedType"
namespace="http://www.SomeCompany"
xsdtype="element"
schematype="anyType"
schematype-namespace="http://www.w3.org/2001/XMLSchema"/>
</mappings>
</rwsf-codegen-project>
For complex types mapped to anyType, HydraExpress marshals the element into a stream that includes the root element and any defined namespaces. You can then parse the string using the parser of your choice. If you wish to use the HydraExpress parser rwsf::XmlReader, see the examples under its class entry in the HydraExpress C++ API Reference Guide.