Book a Demo

Author Topic: DefaultValues in XSD-Schema  (Read 14252 times)

ChooseYourFate

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
DefaultValues in XSD-Schema
« on: August 14, 2013, 07:42:09 pm »
Hi there,

I have a UML-DataModel in EA and want to export it as a xsd schema.
For a view members (enums) there are default-Values neccessary. Those are allready defined in EA.

Now i expected to find the default values in the xsd-schema. But they are ignored in the schema generation. As written in the documentation a default value is possible vor the stereotype element and attribute.

As i'm a beginner i dont know much about the schema generation process. Is there a Option i have to check or a file i have to edit to include a default value for Classmembers in the xsd.schema of my data model?

Thx in Advance.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DefaultValues in XSD-Schema
« Reply #1 on: August 14, 2013, 09:16:38 pm »
It's quite some time I used it. But I remember that XSD generation is quite limited. Simply because XSD can do much more than UML can do. You need some restrictions to map XSD against UML and vice versa (there are some articles on the net which describe that). EA has its own implementation which is more or less hard wired. For that reason when I used it (some years ago) I wrote my own XSD im/-export with own specific restrictions and extensions.

q.

ChooseYourFate

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: DefaultValues in XSD-Schema
« Reply #2 on: August 14, 2013, 11:26:13 pm »
First of all thanx for the quick answer.

That the xsd-Export is limited to attributes and ignores functions is bad but i accepted it as is. But in the XML-Profile there is the stereotype "attribute" defined which includes a default-value.

According to the Documentation such a Profile can be used to modify the Schema Generation.

http://www.sparxsystems.com/resources/xml_schema_generation.html

mhhh maybe someone other had the same problem/idea.

@qwerty did you write a plugin for EA or did you access the db-File via your own Tool?

tx in Advance

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DefaultValues in XSD-Schema
« Reply #3 on: August 15, 2013, 12:42:51 am »
Yes. It were two lengthy scripts. One for ex- and import each. It was written in Perl for a customer so I can't send you the code. Depends on your needs, but if your going heavily into XSD you should consider writing such scripts yourself. The export is straight forward and you should get that to work within one or two days if you are familiar with the API. A pure import is also not too difficult provided you use a good parser from a library. The difficulty is to synch when importing. That will give you some headache.

q.
« Last Edit: August 15, 2013, 12:43:41 am by qwerty »

JayHollingsworth

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: DefaultValues in XSD-Schema
« Reply #4 on: August 15, 2013, 07:11:04 am »
The answer is that you're setting the default in the wrong place.

Even though the normal UML dialogues allow you to enter an initial value, the XML Schema generator doesn't use it.

The XML Schema Generator expects there to be a tagged value called default whose value is set to what you want it to be.

You can either type the tagged value (name ("default") and value) into an existing UML attribute (after making sure the attribute is unlocked (i.e., not private)) or you can drag an element or attribute from the XML Schema toolbox onto an existing class and enter the value for default in the popup properties panel.

In either case the resulting XML schema will have the correct default keyword. In the latter case the attribute will have the XSDelement or XSDattribute stereotype.