Author Topic: XSD Generation - association as ref  (Read 675 times)

Łukasz Dudek

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
XSD Generation - association as ref
« on: February 18, 2009, 10:28:44 pm »
Hi all.
Is there any way to generate association between classes as ref and not as definition of an element with associated class as its type?

I define association like this:


EA generates it as:

<xs:complexType name="PartyContact">
  <xs:sequence>
    <xs:element name="Contact" type="con:Contact" />
  </xs:sequence>
  <xs:attribute name="partyContactType" use="optional" type="con:ContactType">
</xs:complexType>

But I would like to have it generated like this:

<xs:complexType name="PartyContact">
  <xs:sequence>
    <xs:element ref="con:Contact" />
  </xs:sequence>
  <xs:attribute name="partyContactType" use="optional" type="con:ContactType">
  </xs:attribute>
</xs:complexType>

I'm aware, that I can define new field in class PartyContact and mark it as reference, and then EA generates XSD as I want, but I would also like to keep associations in the class diagram.

Namespace con is used in different package.
I would appreciate any help.

VK

  • EA Administrator
  • EA User
  • *****
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Re: XSD Generation - association as ref
« Reply #1 on: February 20, 2009, 09:25:25 am »
To generate a 'ref' attribute, open the tagged-values window for the connector and set the following tagged-values in the 'Connector Source' section :

1. Tag    = anonymousType
    Value = false

2. Tag    = anonymousRole
    Value = true

&#321;ukasz Dudek

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: XSD Generation - association as ref
« Reply #2 on: February 20, 2009, 07:31:31 pm »
Great. This works. Thanks a lot.

Oliver F.

  • EA User
  • **
  • Posts: 573
  • Karma: +2/-1
  • Aren´t we all in the model business ?
    • View Profile
    • Karl Storz homepage
Re: XSD Generation - association as ref
« Reply #3 on: March 25, 2009, 02:13:47 am »
Quote
To generate a 'ref' attribute, open the tagged-values window for the connector and set the following tagged-values in the 'Connector Source' section :

1. Tag    = anonymousType
    Value = false

2. Tag    = anonymousRole
    Value = true

This does not sound like a serious workaround- imagine hundreds of connections to draw where we would have to set the stereotypes for each of those. OK, UML profiles help here a bit, but as even the online help does not give clues (though greatly showing the ref tag without telling how to accomplish this) it would be a good idea to either adapt the help or introduce a connector property (though it should work with a Reference connector type anyway).

Oliver

Update: When applying a transformation those tagged values are lost. So this is definitely not an option, I am afraid.
« Last Edit: March 25, 2009, 02:34:16 am by ofels »