private IComponent ParseElements(IComponent parent, XElement element) { if (Plato.UI.TryGetComponent(element.Name.LocalName, out IComponent component)) { parent.AddChild(component); foreach (var attr in element.Attributes()) { foreach (var attrEntry in attr.Value.Split(',')) { component.ParseAttribute(attr.Name.LocalName, attrEntry.Trim()); } } foreach (var child in element.Elements()) { ParseElements(component, child); } } return(parent); }
public virtual IComponent Clone(IPlatoHelper helper, string id = "", IComponent parent = null) { IComponent clone = New(helper); clone.Parent = parent ?? Parent; foreach (var parsed in Parsed.Where(p => p.Attribute.ToLower() != "id")) { clone.ParseAttribute(parsed.Attribute, parsed.Value); } clone.ParseAttribute("Id", id); foreach (var child in Children) { var cClone = child.Clone(helper, "", clone); clone.AddChild(cClone); } return(clone); }