1
How to Hand Null values in generated classes
Question asked by Brian Grant - February 1 at 2:50 PM
Answered
I have several xsd schemas that will map to org docs. Ive generated classes classes but am having major problems with these classes when working with my applications interface. The interface has to have null fields.
Example:
SimpleClass.NumerofItems
This would display to a text box has to be blank if a value is not or hasent  been   entered.
If this were a class I created id just use int? for the type on the NumerofItems property.
The classes generated by liquid xml don’t allow for this. Ive tried using nilable in the schema but I still don’t get null friendly properties in the generated classes. Ive tried loading xml docs into the class leaving the node out. They load fine but if you try using the property on the class to do any kind of compare it throws an error.
How can I handle this?

2 Replies

Reply to Thread
0
Liquid Support Replied
February 1 at 3:30 PM
Employee Post
Hi,
 
Please see knowledge base article:
 
Basically you can only do this for complexTypes, simpleTypes require you to use the IsValid... properties.
 
I have added this to the requested features for review, as I think this is a valid concept for .Net languages. Although I guess in C++ we could also create a wrapper class to do this (as that is what .Net does for you).
 
 
0
Liquid Support Replied
February 16 at 10:04 AM
Employee Post
Hi,
 
Liquid Studio 2018 is now available and includes an option to 'Generate Nullable Simple Types' :
 

Reply to Thread