private static Entity ReadRow(Entity parent, System.Xml.XmlTextReader r) { if (parent != null && r.AttributeCount <= 1) //tabular section, no attributes or "key" { String tsName = r.Name; if (r.MoveToFirstAttribute()) { if (r.Name.ToLower().Equals("key")) //only key attrbute is allowed { parent.AddTabularSection(tsName, r.Value); } else { throw new Exception(String.Format("Invalid tabular section attribute '{0}'", r.Name)); } } else { parent.AddTabularSection(tsName); } return(parent); } else { Entity entity = new Entity(r.Depth); if (r.MoveToFirstAttribute()) { do { String name = r.Name; r.ReadAttributeValue(); entity.Attributes.Add(name, r.ReadContentAsString()); }while (r.MoveToNextAttribute()); } if (parent != null) { parent.CurrentTabularSection.AddEntity(entity); return(parent); } else { return(entity); } } }