private void ProcessTermSetGroup(XElement xmlNode, LocalTermStore termStore) { string name = this.GetRequiredAttributeValue(xmlNode, TaxmlSpec.NameToken); if (TaxmlSpec.IsReservedName(name)) { // TODO: Handle system groups here throw new NotImplementedException(); } Guid id = this.GetGuidAttributeValue(xmlNode, TaxmlSpec.IdToken) ?? Guid.Empty; LocalTermGroup termGroup = new LocalTermGroup(id, name, termStore.DefaultLanguageLcid); this.ReadTaxmlComments(xmlNode, termGroup); string description = this.GetAttributeValue(xmlNode, TaxmlSpec.DescriptionToken); if (description != null) { termGroup.Description = description; } // Add the group to the term store termStore.AddTermGroup(termGroup); bool processedDescription = false; foreach (XElement childNode in xmlNode.Elements()) { switch (childNode.Name.LocalName) { case TaxmlSpec.DescriptionToken: if (processedDescription) { throw new ParseException("The description cannot be specified more than once", childNode); } processedDescription = true; termGroup.Description = childNode.Value; break; case TaxmlSpec.TermSetToken: this.ProcessTermSet(childNode, termGroup); break; case TaxmlSpec.SyncActionToken: this.ProcessSyncAction(childNode, termGroup); break; default: throw new ParseException("Unimplemented XML tag \"" + childNode.Name.LocalName + "\"", childNode); } } }
public LocalTermStore LoadFromFile(string csvFileName) { LocalTermStore termStore = new LocalTermStore(Guid.Empty, "Term Store"); LocalTermGroup termGroup = termStore.AddTermGroup(Guid.Empty, Path.GetFileNameWithoutExtension(csvFileName)); using (CsvReader csvReader = new CsvReader(csvFileName)) { csvReader.WrapExceptions(() => { ProcessCsvLines(termGroup, csvReader); }); } return(termStore); }