Creating documentation in XSD's

Jick,

I am trying to put an if/then switch in for a document block. I currently have some code:

$indenter.getIndentation()xs:annotation
$indenter.getIndentation()xs:documentation
$class.t_getDocumentation($indenter.getIndentation())</xs:documentation>
$indenter.getIndentation()</xs:annotation>

which generates a nice documentation block in one of my schema.

What I would like to know is the following:

  1. How can I test for the presence of documentation?

If documentation <>""
…write document block…
end

  1. In the $class.t_getDocumentation($indenter.getIndentation()) call is it ossible to remove the CDATA code that is automatically added?

Hi Toby,

I will consult our engineers and then come back to you. By the way, have you tried the early access I sent you with regards to the modeling and generation of XSD?

Best regards,
Jick

Hi Jick - sorry, I meant to get back to you…

Its working perfectly! because of how your engineers have implemented it as a feature I can add any restriction I like from strings to integers.

I have added a couple of default params to make it a bit easier so anything that is stereotyped as xsdSimpleType automatically has a base and restriction added. The only thing missing (and no, I dont expect you to add it) would be to allow inheritance - a superclass with string and a subclass with length=10 or something similar…

The reason for the code request above is so that I can publish the modified instant generator code for others to use in the future.

Please pass on my thanks to your dev’s for a fine piece of work!

Hi Toby,

With regard to your two questions…

  1. We have made a fix (See below for the URL of fix). You can check $utilities.getOriginalDocumentation($THE_OBJECT, $args.get(“property”))

For example:
#set( $originalDocumentation = $utilities.getOriginalDocumentation($THE_OBJECT, $args.get(“property”)) )
#if ( $originalDocumentation && $originalDocumentation != “” )

#end

  1. It is not possible to remove CDATA from t_getDocumentation()
    but you can get the original documentation by $utilities.getOriginalDocumentation($THE_OBJECT, $args.get(“property”))

Here is the URL for the fix of the first template problem:
http://files3.visual-paradigm.com/200707/Patch/sp2_20070712u/VP_Suite_Windows_3_0_sp2_20070712u.exe

Please download this and install by overwriting the current installation. Notice that this is a patch for the current release. If you want a patch for the early access release I sent you earlier, please let me know and we will arrange it for you.

Best regards,
Jick

Cheers Jick, could you make it avalible for the OSX version of the early access version please?

BTW - you do realize that its Saturday!

Hi Toby,

Yes, I do aware :wink:

Oh, I just didn’t aware that you use the Mac version. Please wait…

Best regards,
Jick

Hi Toby,

Here is the Mac version:
http://files3.visual-paradigm.com/200707/Patch/sp2_20070712u/VP_Suite_MacOSX_3_0_sp2_20070712u.dmg

Enjoy! Feel free to let me know if there are any questions.

Best regards,
Jick

Hi Toby,

With regard to the comment you posted earlier:

The only thing missing (and no, I dont expect you to add it) would be to allow inheritance - a superclass with string and a subclass with length=10 or something similar…

Do you mean the ability to model the following in class diagram?

<xsd:simpleType name="foo">
       <xsd:restriction base="xsd:string">
       </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="bar">
       <xsd:restriction base="foo">
         <xsd:length value="2"/>
       </xsd:restriction>
</xsd:simpleType>

Best regards,
Jick

Hi Jick - thats the sort of thing; no doubt it works and I have just not tried it…

I do have a problem with the other fix for documentation. I have the following as code:

$indenter.getIndentation()<xs:element name="$class.getName()">
$indenter.push($indentation)##
$indenter.getIndentation()<xs:annotation>
$indenter.getIndentation()<xs:documentation>
$utilities.getOriginalDocumentation($class, $args.get("property")) </xs:documentation>
$indenter.getIndentation()</xs:annotation>
$indenter.getIndentation()<xs:complexType>
$indenter.push($indentation)##

and I get an output which looks like:

	<xs:annotation>
	<xs:documentation>

$utilities.getOriginalDocumentation($class, $args.get(“property”)) </xs:documentation>
</xs:annotation>

Can you highlight what I am doing wrong please?

Hi Toby,

The information is not enough for us to identify the problem. Could you send us your log file? You can find it under the bin folder of VP Suite. I would be grateful if you can send me your project as well. If you can’t post here, you can send to my Email address directly:
jick@visual-paradigm.com

Best regards,
Jick

Hi Jick,

I have included a zip file with the vp.log, the project and the modified XSD
generator files.

Sorry for the basic mail but my email server is under a bit of water at the
moment; for some reason the British summer seems to be a little on the wet
side so I am having to send this via my mobile phone.

One thing that I have noticed is there are two versions of VP - 20070716a (to
allow for schema types and restrictions) and 20070712u (to fix the
documentation). Not sure if it makes a difference…

Thanks again for such fantastic support over this; trust me when I say that I
have never had this level of support from a commercial company in 15 years of
IT!

Regards

T
Jick.zip

…as you can see, it never made it by phone so cut ‘n’ paste works as well :wink:

Hi Toby,

Have you run in both 20070716a and 20070712u? Both failed?

Best regards,
Jick

Hi Jick - just tried both versions (assuming that you can have them installed in separate directories with no problem) and they both fail…

Let me know if you want me to run any more tests

Hi Toby,

20070712u should include the bug fix required for making it works. We suspect that you have overwritten $utilities, $class or $args.

To test if $utilities is overwritten or not, print $utilities in the .vm to see the result. It should display something like vp.com.instantgenerator.xsd.XsdUtilities@…

Best regards,
Jick

Hi Jick - I was away for a couple of days wine tasting…now its back to work!

I have added $utilities to package.vm and it generates the following output: com.vp.instantgenerator.xsd.XsdUtilities@dd90c3

Hope this helps

T

Hi Toby,

It seems that the only possible reason is you have overwritten $class. E.g.:

#set( $class = “” )
$utilities.getOriginalDocumentation($class, $args.get(“property”))

To test if $utilities is overwritten or not, print $class in the .vm to see the result. It should be something like com.vp.instantgenerator.xsd.XsdClass@…

Best regards,
Jick

Ok, in my production environment I have gone back to 16a as that works and I can generate schema for my developers.

I will load up 12 into a test platform and try it later on…

Ok, still using 16a I get com.vp.instantgenerator.xsd.XsdClass@ad8a46 where the bit after the @ sign is the id of the class

Hi Toby,

Can I say that 20070716a works well, while 20070712u doesn’t? If yes, please try this release:
http://files3.visual-paradigm.com/200708/Patch/sp2_20070724c/VP_Suite_Windows_3_0_sp2_20070724c.exe

This is a newer version of patch.

Best regards,
Jick