Modelling for XML

Hi - this may be a silly question but can some one direct me as to how I can use UML to model XSD’s?

I have played with the reverse engineering side and am comfortable with the concept of modelling and outputting documentation. The one thing that I cannot do is apply constraints to stereotypes. As an example, I would normally create a number of discrete simple types which have xsd patterns applied to them to allow for validation of the content via a parser.

Can someone please point me in the right direction?


Hello TobyAnscombe,

If just for modeling, would it be possible to include the data in the documentation/ comments field? If you want to reuse them in the XSDs generated by instant generator, I would suggest you give us some sample and the expected outcome. If possible, we will consider supporting your requests.

Best regards,

Hi Jick - The comments I have no great issue with as Instant Generator adds a CDATA section which is good enough.

A classic example is where I have a string element and I want to constrain it to 2 char max; in the simpleType def I would express it as facets for the type. It may be my lack of knowledge of UML modeling that is preventing me!

The other alternative is creating a XSLT that will transform a XML or XMI output with some nifty class/package work.

Sorry - let me clarify…

I normally model directly in XML (XSD) as it is something that I am very comfortable with however a client has requested that I work in UML to design a logical model but I also need to create specific views into the model to contextialize the view. If you like the logical model is the universal superset and the business views will be subsets of infomation.

I currently have a class/object model which is the superset and I now need to add attributes to each class. I have a reference conceptual model to work from which provides data standards (string length, min/max values etc). As I add the attributes to the classes I want to ensure that these data standards are applied and are part of the overall model. (eg rather than name being a string I want to expicitly state that it is a string with a min length of 0 and max length of 40 chars.

To enable reviews to be conducted of compliancy to standards and to allow other developers to “build” the business context views I need to output the model as a series of XSD’s - one for the data types (what would normally be the simple types in a schema set), one with all attributes that reference the datatypes and finally one with the structures. Thus, there is maximum reuse of the model as everything is driven from it (documentation, data standards, attribute names etc).

Does this make sense? I bought VP after eval-ing a number of case tools from the class modeling and reporting perspective but I thought it would be a relatively simple task to appy constraints (as I call them) to attributes and to generate xml schema from the UML model