[xsde-users] No polymorphism without substitutionGroup?

Werner Haug werner.haug at agfa.com
Wed Jun 12 05:49:22 EDT 2013


It seems xsde generates no polymorphic code when there is no 
substitutionGroup.
When generating code with
xsde.exe cxx-hybrid --generate-parser --generate-serializer 
--generate-aggregate --generate-polymorphic --generate-typeinfo 
--root-element root --polymorphic-type root --output-dir src 
--no-long-long test.xsd
from

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="base">
    <xs:attribute name="text" type="xs:string"/>
  </xs:complexType>
  <xs:complexType name="derived">
    <xs:complexContent>
      <xs:extension base="base">
        <xs:attribute name="extra-text" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="root_type">
    <xs:sequence>
      <xs:element name="item" type="base" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="root" type="root_type"/>
</xs:schema>

root_paggr::polymorphic () is false

How can I generate code that is able to serialize the following?

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <item text="hello" extra-text="world" xsi:type="derived"/>
</root>


More information about the xsde-users mailing list