Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Recent Topics
Advanced Search
Nillable  
Forum Index -> Customizing Code Generation
Author Message
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Hi Jick,

Sorry to be a pain but blame M$...their dot net framework code is complaining that it wants to see the nillable attribute otherwise it goes nuts....something to do with how it serializes the objects...

I have hacked the code for xsdElementAttribute to be as follows as a work around. Can you ask your engineers to let me know if there is a more elegant solution?

$attribute.t_prepare($args.get("property"))##
## ===== Output =====
#if( $attribute.isComposite() )
$stacks.getStack("composite").push($class)##
#set($class = $attribute.getType())
$stacks.getStack("referenceAttribute").push($referenceAttribute)##
#set($referenceAttribute = $attribute)
#parse("$template-dir/XsdClassSelection.vm")
#set($referenceAttribute = $stacks.getStack("referenceAttribute").pop())##
#set($class = $stacks.getStack("composite").pop())##
#else
$indenter.getIndentation()<xs:element ##
#if( $attribute.getType().isElement() )
ref##
#else
name="$attribute.getName()" type##
#end
="$attribute.t_getTypePrefix()$attribute.t_getTypePrefixPostfix()$attribute.t_getTypeName()" minOccurs="$attribute.t_getMinOccurs()" maxOccurs="$attribute.t_getMaxOccurs()"##
#if( $attribute.hasDefaultValue() )
${space}default="$attribute.getDefaultValue()"
#end
#if ($attribute.getType().isElement() !=true)
#if ($attribute.t_getMinOccurs()=="0")
$space nillable="true"##
#else
$space nillable="false"##
#end
#end
>##
$indenter.push($indentation)##
$attribute.t_getDocumentation($indenter.getIndentation())
$indenter.pop()##
$indenter.getIndentation()</xs:element>
#end
 
Jick


Joined: 2005/04/29
Messages: 2881

Offline

Hi Toby,

Please try this:
Code:
#if ($attribute.getType().isElement() !=true)
    #if ($attribute.t_getMinOccurs()=="0")
        ${space}nillable="true"##
    #else
        ${space}nillable="false"##
    #end
 #end



Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Thats what I wrote!
 
Jick


Joined: 2005/04/29
Messages: 2881

Offline

Oh, I didn't aware that. I am sorry that this is already the most elegant way.

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Cool - I am finally elegant!

 
Jick


Joined: 2005/04/29
Messages: 2881

Offline

Hi Toby,

Our engineers just spot a different:

Yours : $space nillable="true"##
Ours : ${space}nillable="true"##

Your approach will produce two spaces. Not a show stopper though

Best regards,
Jick

Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Thats why they are engineers and I am a user...

Any chance of an updated document set with all the calls and functions in? I cheat and look at some of the other InstantGenerator code samples and lift bits and bobs..even if it is an unsupported document set it would be handy.

As I mentioned, I am off to a new project so I am not sure what the requirements will be but anything that you have which is useful is handy...

Cheers Jick, have a good weekend
 
Jick


Joined: 2005/04/29
Messages: 2881

Offline

Hi Toby,

I have just requested for a more updated version of the API spec. Please find it attached.

Hope you find it useful.

Enjoy your weekend!

Best regards,
Jick

IG API_v2.ods
 Description Download
 Filesize 25 kb
 Downloaded:  115 time(s)


Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
TobyAnscombe


Joined: 2007/01/10
Messages: 43

Offline

Hi Jick, to save me from downloading Open Office can you export it as a HTML or PDF?
 
Jick


Joined: 2005/04/29
Messages: 2881

Offline

Hi Toby,

Certainly. Please find the HTML version attached (zipped).

Best regards,
Jick

IG API_v2.zip
 Description Download
 Filesize 16 kb
 Downloaded:  129 time(s)


Visual Paradigm International Ltd.
http://www.visual-paradigm.com

Build Quality Applications Faster, Better and Cheaper
 
 
   Forum Index -> Customizing Code Generation
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil