[xsd-users] Problem with extension of complexType with simpleContent with required attribute

Ray Lischner rlischner at proteus-technologies.com
Wed Jun 11 11:11:43 EDT 2008


I have a problem with Code Synthesis 2.3.1. (I have not verified that it exists in 3.1.0. We made a number of significant changes to the code generator, and moving to 3.1.0 will require a significant investment of time and effort. I planned on waiting until 3.x stabilized before taking the hit of moving our changes to 3.x.)
 
If a schema has a complexType with simpleContent with a required attribute, and then has another complexType with simpleContent that extends the original type, the constructors are incorrect. For example:
 
<xsd:schema xmlns:demo="urn:demo" xmlns:xsd=http://www.w3.org/2001/XMLSchema targetNamespace="urn:demo">
  <xsd:complexType name="Base">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute name="a" type="xsd:string" use="required"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
  <xsd:complexType name="Derived">
    <xsd:simpleContent>
      <xsd:extension base="demo:Base"/>
    </xsd:simpleContent>
  </xsd:complexType>
</xsd:schema>
 
The generated code for Base's constructor is okay:
  Base (const _xsd_Base::base_& , const a::type&);
The generated code for Derived's constructor, however, requires a Base object and a value for "a". In effect, I must supply two values of "a": one when constructing Base, and 
This value for "a" overwrites the value of "a" that is inherited from Base:
  Derived(const _xsd_Derived::base_&, const a::type&);
 
It seems that Code Synthesis gives Derived's constructor all the inherited attributes, just as it would for a complexContent type. The problem is the first argument, which uses the immediate base class. In this case, the type of the first argument should be xml_schema::string.
 
If this problem has already been fixed, can you give me any hints as to how to patch our 2.3.1 version for the time being--until we can move forward to 3.1?
 
Thank you.      
 
Ray Lischner,
Senior Member of Technical Staff
133 National Business Pkwy, Ste 150         t. 443.539.3448
Annapolis Junction, MD 20701                c. 301.377.7390
rlischner at proteus-technologies.com          f. 443.539.3370

This electronic message and any files transmitted with it contain information which may be privileged and/or proprietary. The information is intended for use solely by the intended recipient(s). If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of this information is prohibited. If you have received this electronic message in error, please advise the sender by reply email or by telephone (443.539.3400) and delete the message. 



More information about the xsd-users mailing list