Book a Demo

Author Topic: XSD Transform  (Read 4141 times)

steve.m

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
XSD Transform
« on: March 27, 2020, 11:59:39 pm »
I am working through the steps to convert a Class model to and XSD representation using the Transform function (Design - Tools - Transform) which I then want to use the Schema composer to generate the XSD and JSON schemas. On working through these steps the result is not quite correct as described in http://www.umlchannel.com/en/enterprise-architect/item/172-model-transformation-and-xsd-schema-generation-mda-sparx. I followed these steps and loaded the XSD Primitive types and the modification to the XSD Transformation template. The result was better however, I am striking some issues I can not explain.

Sometimes, the associations are honoured but many times not. By this I mean that I can remove the generated package and run the transformation again. When I pull the root element into the schema composer, the associations to the other classes may not appear.

An attribute marked as String is supposed to be converted to string during the transformation. This happens. But then this is then converted back to String in the Schema Composer and rendered as a referenced object and not as xs:string. On a couple of occasions, this has worked.

It is not clear why the transformation sometimes works and a lot of times does not. I am wondering if anyone else has followed this workflow and what they have learned from it.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: XSD Transform
« Reply #1 on: March 28, 2020, 12:10:00 am »
We've done this, but I never had the issues you describe.

I do remember have to fiddle a bit with the transformation template in order to get it working, but that was too long ago to remember exactly what I did.

As for the schema composer, it will only show the association who are navigable from the source object.
(and it will only show you one association in case you have many with the same name)

We use the schema composer to create a subset of the XSD model and then generate the XSD from that subset the "old" style.

Geert

steve.m

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: XSD Transform
« Reply #2 on: March 28, 2020, 01:23:01 am »
Thanks Geert,

I saw the point about the directed associations on that Blog Post. I did have aggregations and they had worked. I have now gone to all directed associations with cardinality. The seems to work or are at least more reliable now. But the "string" is still being converted to "String" when imported to the Schema Composer and not being treated as an XSD primitive. The odd thing is, on a couple of occasions, this was being recognised and did come through as "xs:string" but I can not figure out what configuration is required for this to be recognised.

Thanks again for your response. I will just have to keep trying .... I did perform a simple experiment where I created the XML Schema classes from the XML Schema profile, rather than have them generated. This seems to work more reliably. There has to be something not quite set correctly during the transformation but I can not locate any difference as yet.