Nillable

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

Hi Toby,

Please try this:

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

Best regards,
Jick

Thats what I wrote! :slight_smile:

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

Cool - I am finally elegant!

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 :smiley: :smiley:

Best regards,
Jick

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

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

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

Hi Toby,

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

Best regards,
Jick
IG API_v2.zip