public void ReadXml(string xmlString) { _open_file_error = false; _status = ""; _archetype = null; _ontology = null; try { System.IO.StringReader stringReader = new System.IO.StringReader(xmlString); XmlReader xml_reader = XmlReader.Create(stringReader); XmlSerializer xmlSerialiser = new XmlSerializer(typeof(ARCHETYPE)); ARCHETYPE new_archetype = xmlSerialiser.Deserialize(xml_reader) as ARCHETYPE; xml_reader.Close(); _archetype = new_archetype; _ontology = null; } catch (Exception e) { _open_file_error = true; _status = "Open file error: " + e.ToString(); System.Diagnostics.Debug.Assert(false, e.ToString()); } }
public void NewArchetype(string an_archetypeID, string a_languageCode, string defaultLanguageCodeSet) { _archetype = new ARCHETYPE(); _ontology = null; ARCHETYPE_ID archetypeId = new ARCHETYPE_ID(); archetypeId.value = an_archetypeID; _archetype.archetype_id = archetypeId; _archetype.description = new RESOURCE_DESCRIPTION(); _archetype.original_language = new CODE_PHRASE(); _archetype.original_language.code_string = a_languageCode; if (defaultLanguageCodeSet != "") { TERMINOLOGY_ID terminologyId = new TERMINOLOGY_ID(); terminologyId.value = defaultLanguageCodeSet; _archetype.original_language.terminology_id = terminologyId; } _archetype.description.lifecycle_state = "AuthorDraft"; _archetype.concept = "at0000"; _archetype.definition = new C_COMPLEX_OBJECT(); _archetype.definition.node_id = _archetype.concept; string[] y = an_archetypeID.Split(".-".ToCharArray()); _archetype.definition.rm_type_name = y[2]; _archetype.ontology = new ARCHETYPE_ONTOLOGY(); _archetype.ontology.term_definitions = Array.CreateInstance(typeof(CodeDefinitionSet), 1) as CodeDefinitionSet[]; _archetype.ontology.term_definitions[0] = new CodeDefinitionSet(); _archetype.ontology.term_definitions[0].language = a_languageCode; _archetype.ontology.term_definitions[0].items = Array.CreateInstance(typeof(ARCHETYPE_TERM), 1) as ARCHETYPE_TERM[]; _archetype.ontology.term_definitions[0].items[0] = new ARCHETYPE_TERM(); _archetype.ontology.term_definitions[0].items[0].code = "at0000"; _archetype.ontology.term_definitions[0].items[0].items = Array.CreateInstance(typeof(StringDictionaryItem), 2) as StringDictionaryItem[]; _archetype.ontology.term_definitions[0].items[0].items[0] = new StringDictionaryItem(); _archetype.ontology.term_definitions[0].items[0].items[0].id = "text"; _archetype.ontology.term_definitions[0].items[0].items[0].Value = "?"; _archetype.ontology.term_definitions[0].items[0].items[1] = new StringDictionaryItem(); _archetype.ontology.term_definitions[0].items[0].items[1].id = "description"; _archetype.ontology.term_definitions[0].items[0].items[1].Value = "*"; AddDescriptionItem(_archetype.original_language); }
public void OpenFile(string a_file_name) { _open_file_error = false; _status = ""; _archetype = null; _ontology = null; try { XmlReader xml_reader = XmlReader.Create(a_file_name); XmlSerializer xmlSerialiser = new XmlSerializer(typeof(ARCHETYPE)); ARCHETYPE new_archetype = xmlSerialiser.Deserialize(xml_reader) as ARCHETYPE; xml_reader.Close(); _archetype = new_archetype; _ontology = null; } catch (Exception e) { _open_file_error = true; _status = "Open file error: " + e; System.Diagnostics.Debug.Assert(false, e.ToString()); } }