/// <summary> /// Gets the content from the SIFElement for the specified version of SIF. Only /// elements that apply to the requested version of SIF will be returned. /// </summary> /// <param name="element">The element to retrieve content from</param> /// <param name="version"></param> /// <returns></returns> public virtual IList <Element> GetContent(SifElement element, SifVersion version) { List <Element> returnValue = new List <Element>(); ICollection <SimpleField> fields = element.GetFields(); foreach (SimpleField val in fields) { IElementDef def = val.ElementDef; if (def.IsSupported(version) && !def.IsAttribute(version) && def.Field) { returnValue.Add(val); } } IList <SifElement> children = element.GetChildList(); foreach (SifElement val in children) { IElementDef def = val.ElementDef; if (def.IsSupported(version)) { returnValue.Add(val); } } MergeSort.Sort <Element>(returnValue, ElementSorter <Element> .GetInstance(version)); //returnValue.Sort( ElementSorter<Element>.GetInstance( version ) ); return(returnValue); }
/// <summary> /// Gets the fields from the SIFElement for the specified version of SIF. Only /// the fields that apply to the requested version of SIF will be returned. /// </summary> /// <param name="element"></param> /// <param name="version"></param> /// <returns></returns> public virtual ICollection <SimpleField> GetFields(SifElement element, SifVersion version) { ICollection <SimpleField> fields = element.GetFields(); List <SimpleField> returnValue = new List <SimpleField>(); // remove any fields that do not belong in this version of SIF foreach (SimpleField field in fields) { IElementDef def = field.ElementDef; if (version.CompareTo(def.EarliestVersion) > -1 && version.CompareTo(def.LatestVersion) < 1) { returnValue.Add(field); } } returnValue.Sort(ElementSorter <SimpleField> .GetInstance(version)); return(returnValue); }