Xsd modeling - no documentation for use of xs:simpleType, xs:restriction

Hi,

I looked into the VP-UML documentation and on the Visual Paradigm website but it looks like there is no detailed documentation for XSD modeling in combination with Instant Generator (regarding use of stereotypes xs:simpleType, xs:restriction, xs:enumeration etc. in UML class diagrams to get these in generated XML schema)

For example: How to model classes / attributes with the built-in VP-UML xsd stereotypes in order to get the following schema when using XSD Instant Generator:



  <xs:attribute name="priority">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="high"/>
          <xs:enumeration value="medium"/>
          <xs:enumeration value="low"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
 

Please provide examples / documentation how to make use of the built-in xsd stereotypes !

Also I would appreciate more details on tagged values / best practices when using tagged values for modeling in combination with Instant Generator.

Thanks + best regards,

Jan Harmsen

Hi Jan Harmsen,

Sorry for my late response! I’ve forwarded the details to our engineers to follow-up. Once there is any feedback, I’ll come back to you immediately.

If there is any inquiry, please do not hesitate to contact me.

Best regards,
Lilian Wong

Hi Jan Harmsen,

We’ve prepared a sample project to make use of built-in xsd stereotypes, you can find the link to download it below. If you want to know how to model XSD for Instant Generator, you can write an example and use “Instant Reverse”.

For tagged values for Instant Generator, I’m sorry that there is no special issue when using tagged values for Instant Generator since tagged values is designed for users to put its own values for customization (e.g. plugin, Instant Generator…).
You can use the tagged values API as shown below for customizing code generation in Instant Generator:

taggedValueArray() : TaggedValue[]
taggedValueAt(int) : TaggedValue
taggedValueCount() : int
taggedValueIterator() : Iterator

TaggedValue.getType() : int
( Text = 0, ModelElement = 1, Enumeration = 2, HTML = 3, Multi-Line Text = 4 )

TaggedValue.getValue().getName()
( return text value or name of model element value )

As we fixed the problem of not allowing tagged values with duplicated names, please download the latest build as well. Here are the links for the sample project and the build:

Sample Project
http://files2.visual-paradigm.com/200808/Lilian/sample_project.zip

Patch
http://files2.visual-paradigm.com/200808/Patch/20080707zm/VP_Suite_Windows_3_3_20080707zm.exe

I hope these will help. If there is any further inquiry, please do not hesitate to contact me.

Best regards,
Lilian Wong

Hi Lilian,

let me first thank you for your quick feedback and support !

I just switched to VP-UML and have been working with it for only 3-4 weeks now but one thing I can already say after sending some bug reports and receiving feedback and bugfixes very fast:

Your / Visual Paradigm’s support so far is OUTSTANDING and an excellent example for many many other software companies how to deal with customers. Support was not the reason for me to switch to VP-UML, but now that I experience your support I have to say it’s one more reason to switch and I’m glad I’m using VP-UML !

Could you please provide a link to a Mac OSX version of the patched VP-UML ? I work on Mac OSX and could not open the demo project you provided since it requires the patched VP-UML.

Thanks + best regards,

Jan

Hi Jan,

Thanks for your positive feedback to our support!

I’m sorry that I do not know you are using Mac OS X, please download the latest patch for Mac from the link below:
http://files2.visual-paradigm.com/200808/Patch/20080707zp/VP_Suite_MacOSX_3_3_20080707zp.dmg

If there is anything I can help, please feel free to contact me.

Best regards,
Lilian Wong

Hi Lilian,

thanks for quickly providing patched Mac OSX version - I was able to open the sample project:

You / your engineers provided exactly what I was looking for, thanks a lot !

Unfortunately I found one problem with this patched version which I think I did not have before:
After adding Stereotype ‘XSDattribute’ to an UML attribute and then opening Specification Tab ‘XML Schema’ I used to be able to set value for ‘use’ from default setting ‘unsepcified’ to ‘required’.
Now when I do this and click ‘apply’ / ‘ok’ and then close the specification, the next time I open tab ‘XML Schema’ it it is back to ‘unspecified’, so my changes did not get applied.

Could this be fixed ? I checked the log file but it did not show any errors.

Thanks + best regards

Jan

Hi Jan,

Thanks for replying. I’ve passed this issue to our engineers to follow-up. If I get any feedback, I’ll come back to you immediately.

Best regards,
Lilian Wong

Hi Jan,

I would like to notify you that we fixed the problem of setting “required” in XML Schema of attribute, please download the latest patch at the link below:
http://files2.visual-paradigm.com/200808/Patch/20080707zq/VP_Suite_MacOSX_3_3_20080707zq.dmg

If you need any assistance, please do not hesitate to ask.

Best regards,
Lilian Wong

Hi Lilian,

thanks a lot, the patch worked as promised, your support is simply excellent :smiley:

Here a quick summary for other readers how to model XSD enumerations so they don’t have to download the demo file but can start modeling right away:

How to define an xsd enumeration with VP-UML using tagged values:

  1. create UML Class ‘MyEnumerationType’ and assign Stereotype XSDsimpleType
  2. add Tagged Value ‘xs:restriction@base’ of type ‘Text’ and set value for restriction base (e.g. ‘xs:string’)
  3. add Tagged value ‘xs:restriction/xs:enumeration@value’ of type ‘Text’ and set value (e.g. ‘high’)
  4. add Tagged value ‘xs:restriction/xs:enumeration@value’ of type ‘Text’ and set value (e.g. ‘medium’)
  5. add Tagged value ‘xs:restriction/xs:enumeration@value’ of type ‘Text’ and set value (e.g. ‘low’)
  6. start Instant Generator for XML Schema and you get
 
	<xs:simpleType name="MyEnumerationType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="high"></xs:enumeration>
			<xs:enumeration value="medium"></xs:enumeration>
			<xs:enumeration value="low"></xs:enumeration>
		</xs:restriction>
	</xs:simpleType>
 

The XML Schema Instant Generator uses scripts (text files) which can be customized
e.g. for adding your own types to be included in the generated XML schema.
The location of these scripts is:

VP-Suite-install-directory/resources/instantgenerator/xsd/  

Best regards,

Jan Harmsen

Hi Jan,

You are welcome.

And I must thank for your details for other users, you are really helpful!
If there is anything I can do to help, please let me know!

Best regards,
Lilian Wong