Exemplo n.º 1
0
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            var nextNode = new XmlNodeBuilder(binder.Name, this.parent);

            this.AddNode(nextNode);
            result = nextNode;
            return(true);
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 internal void AddNode(XmlNodeBuilder node)
 {
     this.children.Add(node);
 }
Exemplo n.º 6
0
 internal ChildXmlNodesBuilder(XmlNodeBuilder parent = null)
 {
     this.parent   = parent;
     this.children = new List <XmlNodeBuilder>();
 }