Using MagicDraw/Cameo as an XML editor

General discussions about code engineering

Moderator: Moderators

Using MagicDraw/Cameo as an XML editor

Postby » Thu Jan 09, 2014 2:48 pm

In the thread below Tomas explained how to reverse engineer an XSD and convert it to a pure UML model that does not have the XML-specific stereotypes. What if I simply want to use MagicDraw as an editor for XML Schemas and XML Documents; in other words, when I reverse engineer an XML Schema or Document, I want to preserve the XML-specific stereotypes and when I edit the XML-specific UML model I want to update the XML Schema or XML Document file that I had loaded into MagicDraw. Is there a way to do this?

David Frankel

3 posts • Page 1 of 1
Import XSD file within MagicDraw
Postby Hellin_T » Mon Aug 12, 2013 7:18 am

Good afternoon,

We are actually modeling our processes and information exchange within MagicDraw following the UMM2 methodology.
We would like to use UN/CEFACT codes lists. These code lists are available in XSD schemes (for example on the next link ... g_D12A.xsd) and we would like to know if it is possible to import XSD within MagicDraw to avoid having to create these enumeration lists manually.

Thanks in advance for your response

Kind regards

User avatar
Forum Beginner
Forum Beginner

Posts: 42
Posts Rating:0
Joined: Thu Aug 23, 2012 8:35 am
Full name: Thibaut Hellin
vote up
vote down
Re: Import XSD file within MagicDraw
Postby TomasJkn » Tue Aug 13, 2013 6:39 am

Hello dear Hellin,

It is possible and quite easy to do. It is 2-step process:
First you need to reverse-engineer the XSD into the schema model in MagicDraw.
Then you need to transform this schema model to plain/simple UML model.

To reverse engineer the schema, create the code engineering set for XML schemas, open it, add your schema file(s) to it, OK. Then rightclick the CE set and press reverse.

The result will be the schema model in MagicDraw. But this schema model is platform specific - it is adapted for engineering XMl schemas, so it is not a pure/simple UML elements but UML elements with a lot of stereotypes applied. In particular, the enumerations declared in the file turn into UML classes with <<XSDSimpleType>> stereotype applied, having a bunch of UML properties with <<XSDenumeration>> stereotype applied. This is not what we want - we want a simple UML enumeration, carrying enumeration literals.

So we need to "purify" it - transform it into pure platform-independent UML model.
1) Go To Tools>Model Transformations to open the transformation dialog;
2) pick the XML Schema to UML transformation in the first step
3) in the second step choose your XMl schema model parts that you need to transform (include your reversed XML schema models into transformation source). If you do not need the XML schema model for other purposes you can choose to transform in-place. Otherwise (if you need to retain the XML schema models) pick some target package where your UML model will be placed after the transformation
4) skip the wizard's 3rd and 4th steps. Finish

After transformation, you should get plain/simple UML Enumerations in the transformation results package.

I have prepared a small example from the schema that you provided. Please see the attached CEFACTImport.mdzip project (MD v17.0.4 is needed).
There is a code engineering set to reverse the UNECE_DocumentNameCodeBilling_D12A.xsd,
the reversed XML schema model is under Data::XSD::urn:un:unece:uncefact:codelist:standard:UNECE:DocumentNameCodeBilling:D12A
the transformed pure UML model is under Data::UML

Please see the Data::UML::urn:un:unece:uncefact:codelist:standard:UNECE:DocumentNameCodeBilling:D12A::DocumentNameCodeBilling diagram, showing the results - DocumentNameCodeBillingContentType enumeration.


Please note: XML schema engineering features (reverse/generation from/to files, UML <--> XSD transformations) are provided by the CameoDataModeler plugin - you need to have it purchased/installed to follow the path listed above.

Tomas Juknevicius
Forum Beginner
Forum Beginner
Posts: 55
Posts Rating:1
Joined: Thu Jan 12, 2012 7:54 pm

Re: Using MagicDraw/Cameo as an XML editor

Postby PauliusGrigaliunas » Fri Jan 10, 2014 8:40 am


after modifying XML-specific UML model just right click on CE set and select Generate menu option.

Kind regards,
Paulius Grigaliunas
Customer Support
Customer Support
Posts: 59
Posts Rating:0
Joined: Mon Jul 19, 2010 1:37 am

Re: Using MagicDraw/Cameo as an XML editor

Postby fahad » Tue Mar 17, 2020 7:40 pm

adding on to the thread so context is understood.
Let's suppose that we have updates to the XSD that will now need to be reflected in the UML model. I can place the schema files in the appropriate directory and refresh to update the XML specific model. Once the transformation is executed the elements are generated as expected and updated; however UIds of these newly transformed elements are different from previous version of the UML model.
This causes an issue where UMl mode elements were used in diagrams and are no longer available in the model.
I thought unchecking reset default properties may have the desired effect but this do not work as expected .

Any workarounds ?

I will try to post an example of the issue .....currently using CEA 19.0 SP2p0
Forum Newbie
Forum Newbie
Posts: 4
Posts Rating:0
Joined: Mon Dec 17, 2018 8:47 am

Return to Code engineering

Who is online

Users browsing this forum: No registered users and 0 guests