Book a Demo

Author Topic: Adding new XSD data types for auto generation...  (Read 5901 times)

wad62

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Adding new XSD data types for auto generation...
« on: June 20, 2013, 07:50:07 pm »
Hi there, first post on this forum, so be gentle…

Within our environment our data modelling tool of choice is ERwin, Sparx being our EA/SA tool of choice.

We have the Toobus ERwin to Sparx EA bridge, which allows me to port my logical data model from ERwin to an equivalent Class Diagram in Sparx EA, which it does very well.

The ultimate goal being to generate XSD object payloads from the Class Diagram model within Sparx, which is almost working perfectly except for one small issue. I’m losing my attribute data type definitions at XSD generation time, and am merely getting undelimited ‘string’ for all of the element definitions.

This is understandable as obviously data types such as CHAR(18) are meaningless to the XSD generator, so my question is…

How can I add new data types to the XSD generator? What I want is for an attribute with a CHAR(18) datatype to be represented as an XSD element of ‘string’ with a max length of 18, upon XSD generation.

To this end I’ve added a new data type or CHAR(18) (common type string length 18) to the XSD product (after adding XSD as a product), via settings/code engineering data types/programming languages datatypes.

…however upon XSD generation I am still receiving the following message;

“Warning no XSD type found for: "CHAR(18)".  Default is: xs:string”

Whilst I appreciate that in certain circumstances an element of unbounded string will be advantageous, I would still like to be able to implement data type and length constraints in my XSDs

Obviously I’m doing something wrong…has anyone else found a way of overcoming this problem, without a lot of manual knife and forking. I’d like to avoid having to include a whole list of potential XML element types in each XSD.

Thanks,

Will




wad62

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #1 on: June 25, 2013, 10:20:45 pm »
...anyone?  :(

wad62

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #2 on: March 19, 2015, 07:15:10 pm »
....at all!  :o

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #3 on: March 19, 2015, 09:06:57 pm »
Well, some years ago I generated XSD with a 500 lines Perl script. The import script had 200 lines. They worked well and we had the opportunity to modify them to our needs.

q.

wad62

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #4 on: March 20, 2015, 07:20:08 pm »
Cheers for the reply...

So there's no way of adding additional XML data 'types' to the Sparx XSD generator... :(

We'll have to look into a custom script, or continue to use ERwin, as we currently do, which is a real shame, given Sparx's potential, and low cost!!!


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #5 on: March 20, 2015, 09:32:59 pm »
AFAIK the XSD stuff is hard coded in EA. Because we had some peculiarities we decided to go the scripting way. The 500/200 lines might give you an impression on the (medium) complexity. Basically it was written within a day and then we had to deal with those peculiarities over time.

q.

wad62

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #6 on: March 21, 2015, 03:05:44 am »
Thanks again qwerty, scripting it is then... :)
« Last Edit: March 21, 2015, 03:06:17 am by wad62 »

Rodrigo Nascimento

  • EA User
  • **
  • Posts: 33
  • Karma: +3/-0
    • View Profile
Re: Adding new XSD data types for auto generation.
« Reply #7 on: March 25, 2015, 12:16:02 am »
Hi Will,

We are using a similar approach for a client. I may be able to 'partially' answer you question...  ;)

First, I need to understand if you are following the Model Driven Architecture (MDA) approach. For example, we create a Platform Independent Model when we import Erwin models into Sparx EA, then we use the MDA Transformation Template to convert it to a XSD model (Platform Specific Model - PSM). Are you using something similar?

We are using the transformation template to do the transformation of the class model data types to the XSD specific data types (i.e. char to xs:string, date to xs:date...). This can solve your data type 'mapping' issue, but I don't know how to use the restrictions for XSD models (as I never had to use them). This will lead to my next point...

Second, I would like to understand why do you nee to use length restrictions.

Cheers,
Rodrigo
Please check my blog for more EA related articles!

http://connection.rnascimento.com