I am trying to put an if/then switch in for a document block. I currently have some code:
which generates a nice documentation block in one of my schema.
What I would like to know is the following:
- How can I test for the presence of documentation?
If documentation <>""
…write document block…
- In the $class.t_getDocumentation($indenter.getIndentation()) call is it ossible to remove the CDATA code that is automatically added?
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?
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!
With regard to your two questions…
- We have made a fix (See below for the URL of fix). You can check $utilities.getOriginalDocumentation($THE_OBJECT, $args.get(“property”))
#set( $originalDocumentation = $utilities.getOriginalDocumentation($THE_OBJECT, $args.get(“property”)) )
#if ( $originalDocumentation && $originalDocumentation != “” )
- 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:
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.
Cheers Jick, could you make it avalible for the OSX version of the early access version please?
BTW - you do realize that its Saturday!
Yes, I do aware
Oh, I just didn’t aware that you use the Mac version. Please wait…
Here is the Mac version:
Enjoy! Feel free to let me know if there are any questions.
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?
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:
$utilities.getOriginalDocumentation($class, $args.get("property")) </xs:documentation>
and I get an output which looks like:
$utilities.getOriginalDocumentation($class, $args.get(“property”)) </xs:documentation>
Can you highlight what I am doing wrong please?
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:
I have included a zip file with the vp.log, the project and the modified XSD
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
…as you can see, it never made it by phone so cut ‘n’ paste works as well
Have you run in both 20070716a and 20070712u? Both failed?
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
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@…
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
It seems that the only possible reason is you have overwritten $class. E.g.:
#set( $class = “” )
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@…
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
Can I say that 20070716a works well, while 20070712u doesn’t? If yes, please try this release:
This is a newer version of patch.