[xsde-users] No polymorphism without substitutionGroup?

Werner Haug werner.haug at agfa.com
Wed Jun 12 10:38:50 EDT 2013


Thank you, that helped.
The example was from the codesynthesis cxx/tree documentation.
In my "real world" XSD the polymorphic base type is defined with 
abstract="true".
In the original file I got, there was no root element.
The serialized XML element should have the name of the base type.
If I add an element with the name of the base type, no pre() and post() 
functions are generated. Is that correct?

Example:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="base" abstract="true">
    <xs:sequence>
      <xs:element name="nam" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="derived">
    <xs:complexContent>
      <xs:extension base="base">
        <xs:sequence>
          <xs:element name="value" type="xs:int"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="base" type="base"/>
</xs:schema>

The resulting serialized XML should be:
<base xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" 
xs:type="derived">
  <nam>any name</nam>
  <value>1</value>
</base>

How do I have to treat such a case? Is the pre() and post() not necessary 
in that case?


More information about the xsde-users mailing list