[xsd-users] RE: xsd bypasses customized types

Boris Kolpackov boris at codesynthesis.com
Wed Apr 21 09:04:42 EDT 2010


Hi Richard,

Richard Cresswell <rcresswell at gmail.com> writes:

> Don't we still have the same problem that we saw at the beginning of
> this thread though?  The from-base class constructor is being
> suppressed because it is trying to use the fundamental value
> constructors.

With the original patch that I sent to Ray, the from-base c-tor is not
suppressed if (1) you specify the --generate-from-base-ctor option
and (2) there is a custom type in the inheritance hierarchy. If I have
a schema fragment like this:

  <simpleType name="base">
    <union memberTypes="NCName"/>
  </simpleType>

  <complexType name="derived">
    <simpleContent>
      <extension base="test:base">
        <attribute name="x" type="string"/>
      </extension>
    </simpleContent>
  </complexType>

Which I then compile with '--custom-type base' and --generate-from-base-ctor,
I get the following c-tors in the generated derived class:

  derived (const char*);
  derived (const std::string&);
  derived (const test::base&);


> I think I might be having trouble envisioning the cases that you say
> this would break.  Isn't the suppression of the from-base constructor
> and its replacement by the fundamental constructors just to counter
> code bloat? 

Yes, that's correct.


> Can you give an example where the functionality I describe would break 
> an object that is derived from a custom type?

When I said that the functionality you proposed would break other code,
I was referring to the suppression of the default c-tor, not the
suppression of the from-base c-tor. 

Boris



More information about the xsd-users mailing list