예제 #1
0
        private ConfigXmlItem Obj2XmlItems(string key)
        {
            Hashtable     ht   = this._hashData[key];
            ConfigXmlItem item = new ConfigXmlItem();

            item.SetProperty(ConfigXmlContext.XmlKeyId, key);
            foreach (ConfigXmlItem cxi in ht.Values)
            {
                item.SetSubItem(cxi);
            }
            return(item);
        }
예제 #2
0
        private void Xml2ObjHashtableItems(ConfigXmlItem topElement, string key)
        {
            Hashtable ht = this._hashData[key];

            ht.Clear();
            ConfigXmlItem nodes = topElement.GetSubItem(key) as ConfigXmlItem;

            for (int i = 0; i < nodes.SubItemCount; i++)
            {
                IConfigXmlItem item = nodes.GetSubItem(i);
                ht.Add(item.GetProperty(ConfigXmlContext.XmlKeyId), item);
            }
        }
예제 #3
0
        public void Xml2Obj(string xml)
        {
            if (string.IsNullOrEmpty(xml) ||
                this.IsXmlBefore890(xml))
            {
                return;
            }

            ConfigXmlItem topElement = new ConfigXmlItem();

            topElement.FromXml(xml);
            foreach (string k in this._dataKeys)
            {
                this.Xml2ObjHashtableItems(topElement, k);
            }
        }
예제 #4
0
        public string Obj2Xml()
        {
            //this.Obj2XmlGetSelectedNode();
            //this.Obj2XmlGetAllFinalNodes();
            ConfigXmlItem topElement = new ConfigXmlItem();

            topElement.SetProperty(ConfigXmlContext.XmlKeyId, ReportCenterDataService.KeyReportCenterState);
            foreach (string k in this._dataKeys)
            {
                topElement.SetSubItem(this.Obj2XmlItems(k));
            }

            //System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            //topElement.ToXml(doc, null);
            //doc.Save(@"C:\Documents and Settings\ldq\桌面\test.xml");

            //xml为数据库字段,存入之前'需要转义
            return(topElement.ToXml().Replace("'", "''"));
        }