LoadOps() public method

加载级一级的opsXml(自动抽取根节点名)
public LoadOps ( string p_ops ) : void
p_ops string 上一级opsXml
return void
Example #1
0
        public void Bind(string opsXml)
        {
            if (string.IsNullOrEmpty(opsXml))
            {
                return;
            }

            OpsReader reader = new OpsReader();

            reader.LoadOps(opsXml);

            this.Name = reader.RootName;

            while (reader.Read())
            {
                XItem item = new XItem();
                item.Name = reader.Name;

                if (reader.IsTextOnly())
                {
                    item.Type = XType.Xml;
                    item.Text = reader.Data;
                }
                else
                {
                    item.Type = reader.Type();
                    item.Note = reader.Note();
                    item.Text = reader.Text();
                }

                Add(item);
            }
        }
Example #2
0
        public void Bind(string opsXml)
        {
            OpsReader read = new OpsReader();

            read.LoadOps(opsXml);

            while (read.Read())
            {
                T dom = Activator.CreateInstance <T>();

                dom.Bind("<" + read.Name + ">" + read.Data + "</" + read.Name + ">");

                this.Add(dom);
            }
        }
Example #3
0
        public static void Bind(object obj, string opsXml)
        {
            if (opsXml == null || opsXml.Length == 0)
                return;

            Type type = obj.GetType();

            OpsReader reader = new OpsReader();
            reader.LoadOps(opsXml);

            while (reader.Read())
            {
                SetText(type, obj, reader.Name, Escape.XmlUnEscape(reader.Text()));
            }
        }
Example #4
0
        public static void Bind(object obj, string opsXml)
        {
            if (opsXml == null || opsXml.Length == 0)
            {
                return;
            }

            Type type = obj.GetType();

            OpsReader reader = new OpsReader();

            reader.LoadOps(opsXml);

            while (reader.Read())
            {
                SetText(type, obj, reader.Name, Escape.XmlUnEscape(reader.Text()));
            }
        }