Book a Demo

Author Topic: Generate XSDcomplexType with simpleContent  (Read 4494 times)

Jim Donnelly IATA

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Generate XSDcomplexType with simpleContent
« on: July 04, 2015, 03:35:02 am »
Hi

Is anyone aware of how to generate XSDcomplexType with simpleContent extending an XSD built-in type such as xs:string, without creating an underlying XSDsimpleType ?

In our xsd file to be produced, we wish to have an XSDcomplexType with simpleContent and extension base = xs:string.  If we were extending an XSDsimpleType, we would in the EA XSD model create a Generalization with stereotype of XSDExtension between the two.  However when wanting to extend an XSD built-in type, we don’t have an artefact to point the Generalization to.  EA offers a package with simple types representing the xsd built-in types. We tried to point the generalization to the simple type ‘String” in that package, but the xsd generator would then generate an extension base =”string” with string being a simple type that it also generates into the xsd file.  This is not what we want, because we want an extension directly on the built-in type, without an artificial simple type string. Below is the xsd code  we want to achieve.
            
<xs:complexType name="FreeTextType">
      <xs:annotation>
            <xs:documentation xml:lang="en">Textual information to provide descriptions and/or additional information.</xs:documentation>
                        </xs:annotation>
                        <xs:simpleContent>
                                    <xs:extension base="xs:string">
                                                <xs:attributeGroup ref="LanguageGroup"/>
                                    </xs:extension>
                        </xs:simpleContent>
            </xs:complexType>
« Last Edit: July 04, 2015, 03:35:45 am by anaXaIATA »

Rodrigo Nascimento

  • EA User
  • **
  • Posts: 33
  • Karma: +3/-0
    • View Profile
Re: Generate XSDcomplexType with simpleContent
« Reply #1 on: July 09, 2015, 11:03:33 pm »
Hi Jim,

I think I've figured out how to do it... and it is actually pretty simple...

In order to extend the XSD primitive data types, you need to use the XSDDataType packages that is available in the following link:

http://www.sparxsystems.com/downloads/profiles/XSDDataTypes.xml

Use the EA's XMI import functionality to import the package. Then just use the 'string' primitive type as your generalisation.

Please let me know if it works for you.

Regards,
Rod

Please check my blog for more EA related articles!

http://connection.rnascimento.com