private static void FillTemplateFromXml(XmlNode dataListNode, DataTemplate dataTemplate) { foreach (var dataNode in dataListNode.ChildNodes.OfType <XmlElement>()) { foreach (var attribute in dataNode.Attributes.OfType <XmlAttribute>()) { dataTemplate.AddAttribute(attribute.Name.ToCamelCase(), attribute.Value); } if (!dataNode.HasChildNodes) { continue; } var childNode = dataNode.FirstChild; if (childNode is XmlText) { dataTemplate.AddAttribute("Text", dataNode.FirstChild.Value); } else { LoadOrFillChildTemplateFromXml(dataTemplate, childNode); } } }
private static void FillTemplateFromXml(XmlNode dataListNode, DataTemplate dataTemplate) { foreach (var dataNode in dataListNode.ChildNodes.OfType<XmlElement>()) { foreach (var attribute in dataNode.Attributes.OfType<XmlAttribute>()) dataTemplate.AddAttribute(attribute.Name.ToCamelCase(), attribute.Value); if (!dataNode.HasChildNodes) continue; var childNode = dataNode.FirstChild; if (childNode is XmlText) dataTemplate.AddAttribute("Text", dataNode.FirstChild.Value); else { LoadOrFillChildTemplateFromXml(dataTemplate, childNode); } } }