private void ParseSchema(XmlDocument doc) { XmlNodeList lst = doc.GetElementsByTagName("SECTION"); if (lst.Count == 0) { throw new XmlException("Could not locate the 'TABLE' node." + Environment.NewLine + "The Schema is case sensitive."); } // Process Each Section added to Sections Collection foreach (XmlNode tableNode in lst) { string Name = ""; SectionFormat fileformat = SectionFormat.FixedWidth; foreach (XmlAttribute attribute in tableNode.Attributes) { switch (attribute.Name.ToLower()) { case "name": Name = attribute.Value; break; case "sectionformat": fileformat = (SectionFormat)Enum.Parse(typeof(SectionFormat), attribute.Value); break; } } Section section = new Section(Name, fileformat); TextFieldCollection m_TextFields = ParseSchemaSection(tableNode); section.TextFields = m_TextFields; sections.Add(section); } }
public void AddRange(TextFieldCollection texValue) { int intCounter = 0; while (intCounter < texValue.Count) { Add(texValue[intCounter]); intCounter++; } }
private TextFieldCollection ParseSchemaSection(XmlNode tableNode) { TextFieldCollection m_TextFields = new TextFieldCollection(); XmlNodeList lst = tableNode.ChildNodes; // GetGetElementsByTagName("FIELD"); TextField field; string name = ""; TypeCode datatype; int length = 0; int startindex = 0; string format = ""; foreach (XmlNode node in lst) { name = ""; datatype = TypeCode.String; length = 0; startindex = -1; format = ""; foreach (XmlAttribute fattribute in node.Attributes) { switch (fattribute.Name.ToLower()) { case "name": name = fattribute.Value; break; case "datatype": datatype = (TypeCode)Enum.Parse(typeof(TypeCode), fattribute.Value); break; case "length": length = Int32.Parse(fattribute.Value); break; case "startindex": startindex = int.Parse(fattribute.Value); break; case "format": format = fattribute.Value; break; } } field = new TextField(name, datatype, length, startindex, format); m_TextFields.Add(field); } return(m_TextFields); }
public TextFieldEnumerator(TextFieldCollection texMappings) : base() { iEnLocal = (System.Collections.IEnumerable)texMappings; iEnBase = iEnLocal.GetEnumerator(); }
public TextFieldCollection(TextFieldCollection texValue) : base() { AddRange(texValue); }
public Section(string Name, SectionFormat Format) { m_TextFields = new TextFieldCollection(); m_Name = Name; m_Format = Format; }