public C_PRIMITIVE_OBJECT MakePrimitiveObject(C_ATTRIBUTE an_attribute, C_PRIMITIVE a_primative) { C_PRIMITIVE_OBJECT result = new C_PRIMITIVE_OBJECT(); if (a_primative != null) { result.item = a_primative; } //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 result.node_id = ""; result.occurrences = default_occurrences(); //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 //else // result.any_allowed = true; add_object(an_attribute, result); switch (a_primative.GetType().ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture)) { case "xmlparser.c_boolean": result.rm_type_name = "BOOLEAN"; break; case "xmlparser.c_integer": result.rm_type_name = "INTEGER"; break; case "xmlparser.c_code_phrase": result.rm_type_name = "CODE_PHRASE"; break; case "xmlparser.c_date": result.rm_type_name = "DATE"; break; case "xmlparser.c_date_time": result.rm_type_name = "DATE_TIME"; break; case "xmlparser.c_duration": result.rm_type_name = "DURATION"; break; case "xmlparser.c_ordinal": result.rm_type_name = "ORDINAL"; break; case "xmlparser.c_quantity": result.rm_type_name = "QUANTITY"; break; case "xmlparser.c_string": result.rm_type_name = "STRING"; break; case "xmlparser.c_time": result.rm_type_name = "TIME"; break; case "xmlparser.c_real": result.rm_type_name = "REAL"; break; default: System.Diagnostics.Debug.Assert(false, a_primative.GetType().ToString() + " is not handled"); break; } return(result); }
public C_PRIMITIVE_OBJECT MakePrimitiveObject(C_ATTRIBUTE an_attribute, C_PRIMITIVE a_primative) { C_PRIMITIVE_OBJECT result = new C_PRIMITIVE_OBJECT(); if (a_primative != null) { result.item = a_primative; } //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 result.node_id = ""; result.occurrences = default_occurrences(); //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1 //else // result.any_allowed = true; add_object(an_attribute, result); switch (a_primative.GetType().ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture)) { case "xmlparser.c_boolean": result.rm_type_name = "BOOLEAN"; break; case "xmlparser.c_integer": result.rm_type_name = "INTEGER"; break; case "xmlparser.c_code_phrase": result.rm_type_name = "CODE_PHRASE"; break; case "xmlparser.c_date": result.rm_type_name = "DATE"; break; case "xmlparser.c_date_time": result.rm_type_name = "DATE_TIME"; break; case "xmlparser.c_duration": result.rm_type_name = "DURATION"; break; case "xmlparser.c_ordinal": result.rm_type_name = "ORDINAL"; break; case "xmlparser.c_quantity": result.rm_type_name = "QUANTITY"; break; case "xmlparser.c_string": result.rm_type_name = "STRING"; break; case "xmlparser.c_time": result.rm_type_name = "TIME"; break; case "xmlparser.c_real": result.rm_type_name = "REAL"; break; default: System.Diagnostics.Debug.Assert(false, a_primative.GetType().ToString() + " is not handled"); break; } return result; }
private static CPrimitive Map(this C_PRIMITIVE model) { CPrimitive primitive; if (model is C_BOOLEAN) { primitive = ((C_BOOLEAN)model).Map(); } else if (model is C_INTEGER) { primitive = ((C_INTEGER)model).Map(); } else if (model is C_STRING) { primitive = ((C_STRING)model).Map(); } else if (model is C_DURATION) { primitive = ((C_DURATION)model).Map(); } else if (model is C_DATE) { primitive = ((C_DATE)model).Map(); } else if (model is C_DATE_TIME) { primitive = ((C_DATE_TIME)model).Map(); } else if (model is C_REAL) { primitive = ((C_REAL)model).Map(); } else { throw new ParseException(string.Format("'{0}' is not a valid primitive type.", model.GetType())); } return(primitive); }