public override bool TryGetMember(GetMemberBinder binder, out object result) { var nextNode = new XmlNodeBuilder(binder.Name, this.parent); this.AddNode(nextNode); result = nextNode; return(true); }
internal XmlNodeBuilder(string tagName, XmlNodeBuilder parent, string innerText = null, IDictionary <string, string> attributes = null) { this.children = new ChildXmlNodesBuilder(); this.parent = parent; this.name = tagName; this.innerText = innerText; this.attributes = attributes; }
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { var innerText = (string)args[0]; Dictionary <string, string> attr = null; if (args.Length > 1) { attr = args[1].GetType().GetProperties().ToDictionary(pr => pr.Name, pr => pr.GetValue(args[1]).ToString()); } var nextNode = new XmlNodeBuilder(binder.Name, this.parent, innerText, attr); this.AddNode(nextNode); result = nextNode; return(true); }
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { var innerText = (string)args[0]; Dictionary <string, string> attr = null; if (args.Length > 1) { attr = (Dictionary <string, string>)args[1]; } var nextNode = new XmlNodeBuilder(binder.Name, this.parent, innerText, attr); this.parent.AddNode(nextNode); result = nextNode; return(true); }
internal void AddNode(XmlNodeBuilder node) { this.children.Add(node); }
internal ChildXmlNodesBuilder(XmlNodeBuilder parent = null) { this.parent = parent; this.children = new List <XmlNodeBuilder>(); }